Blame SOURCES/start-dconf-editor.sh

e253fd
#!/usr/bin/bash
e253fd
e253fd
IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo $XDG_DATA_DIRS')
e253fd
e253fd
# To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths
e253fd
# into a temporary directory.
e253fd
bridge_dir=$XDG_RUNTIME_DIR/dconf-bridge
e253fd
mkdir -p "$bridge_dir"
e253fd
e253fd
for dir in "${host_data_dirs[@]}"; do
e253fd
  if [[ "$dir" == /usr/* ]]; then
e253fd
    dir=/run/host/"$dir"
e253fd
  fi
e253fd
e253fd
  schemas="$dir/glib-2.0/schemas"
e253fd
  if [[ -d "$schemas" ]]; then
e253fd
    bridged=$(mktemp -d XXXXXXXXXX -p "$bridge_dir")
e253fd
    mkdir -p "$bridged"/glib-2.0
e253fd
    ln -s "$schemas" "$bridged"/glib-2.0
e253fd
    XDG_DATA_DIRS=$XDG_DATA_DIRS:"$bridged"
e253fd
  fi
e253fd
done
e253fd
e253fd
export XDG_DATA_DIRS
e253fd
exec dconf-editor "$@"