From 204ae71dd980a092e4781879a82b64bed5dd07df Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Tue, 7 May 2024 22:59:33 -0700 Subject: [PATCH] Maybe... --- ui/build-aux/start-breezy-desktop.sh | 34 +++++++++++++++++++ ui/com.xronlinux.BreezyDesktop.json | 19 +++++++++-- .../com.xronlinux.BreezyDesktop.desktop.in | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 ui/build-aux/start-breezy-desktop.sh diff --git a/ui/build-aux/start-breezy-desktop.sh b/ui/build-aux/start-breezy-desktop.sh new file mode 100644 index 0000000..33cc604 --- /dev/null +++ b/ui/build-aux/start-breezy-desktop.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo "$XDG_DATA_DIRS"') + +# To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths +# into a temporary directory. +bridge_dir=$XDG_RUNTIME_DIR/dconf-bridge +mkdir -p "$bridge_dir" + +HOST_XDG_DATA_DIRS="" + +for dir in "${host_data_dirs[@]}"; do + if [[ "$dir" == /usr/* ]]; then + dir=/run/host/"$dir" + fi + + schemas="$dir/glib-2.0/schemas" + if [[ -d "$schemas" ]]; then + bridged=$(mktemp -d XXXXXXXXXX -p "$bridge_dir") + mkdir -p "$bridged"/glib-2.0 + ln -s "$schemas" "$bridged"/glib-2.0 + HOST_XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS}:${bridged}" + fi +done + +# We MUST prepend the host's data dirs BEFORE the Flatpak environment's own dirs, +# otherwise data (such as default values) load in the wrong order and would then +# incorrectly prefer the Flatpak's internal defaults instead of the host's defaults! +if [[ ! -z "${HOST_XDG_DATA_DIRS}" ]]; then + XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS:1}:${XDG_DATA_DIRS}" +fi + +export XDG_DATA_DIRS +exec breezydesktop "$@" \ No newline at end of file diff --git a/ui/com.xronlinux.BreezyDesktop.json b/ui/com.xronlinux.BreezyDesktop.json index 3696228..de365ea 100644 --- a/ui/com.xronlinux.BreezyDesktop.json +++ b/ui/com.xronlinux.BreezyDesktop.json @@ -13,9 +13,10 @@ "--device=shm", "--talk-name=ca.desrt.dconf", "--filesystem=xdg-run/dconf", + "--filesystem=host:ro", "--env=DCONF_USER_CONFIG_DIR=.config/dconf", "--env=GIO_EXTRA_MODULES=/app/lib/gio/modules/", - "--env=GSETTINGS_BACKEND=dconf" + "--talk-name=org.freedesktop.Flatpak" ], "cleanup" : [ "/include", @@ -55,6 +56,20 @@ } ] }, + { + "name": "scripts", + "buildsystem": "simple", + "build-commands": [ + "install -Dm 755 start-breezy-desktop.sh /app/bin/start-breezy-desktop" + ], + "sources": [ + { + "type": "file", + "path": "build-aux/start-breezy-desktop.sh" + } + ] + }, + { "name" : "breezydesktop", "builddir" : true, @@ -62,7 +77,7 @@ "sources" : [ { "type" : "dir", - "source" : "./" + "path" : "." } ] } diff --git a/ui/data/com.xronlinux.BreezyDesktop.desktop.in b/ui/data/com.xronlinux.BreezyDesktop.desktop.in index 10e955d..f9c4d24 100644 --- a/ui/data/com.xronlinux.BreezyDesktop.desktop.in +++ b/ui/data/com.xronlinux.BreezyDesktop.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] Name=breezydesktop -Exec=breezydesktop +Exec=start-breezy-desktop Icon=com.xronlinux.BreezyDesktop Terminal=false Type=Application