Skip to content

Commit

Permalink
Be more conservative with gsettings schema handling
Browse files Browse the repository at this point in the history
Try and replicate as much of the host systems gsettings schemas and then
hack/patch this to enable the required settings due to our older version of gtk.

Signed-off-by: Alex Murray <murray.alex@gmail.com>
  • Loading branch information
alexmurray committed Nov 27, 2023
1 parent 85491bb commit 84a5da0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 16 additions & 2 deletions setup-env
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,22 @@ if [ -f "$SNAP/usr/lib/$ARCH/libgtk-3-0/gtk-query-immodules-3.0" ]; then
"$SNAP/usr/lib/$ARCH/libgtk-3-0/gtk-query-immodules-3.0" "$SNAP/usr/lib/$ARCH/gtk-3.0/3.0.0/immodules/"im-*.so > "$GTK_IM_MODULE_FILE"
fi

# Set XDG_DATA_DIRS so that we prefer the snap's and then the
# the hosts gsettings schemas
# The version of gtk that we ship references a gsetting that is now deprecated
# so recompile the hosts gsettings schema to reenable this just for the emacs
# snap
if grep -q org.gnome.settings-daemon.plugins.xsettings.deprecated /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.xsettings.gschema.xml 2>/dev/null; then
export GSETTINGS_SCHEMA_DIR="$SNAP_USER_COMMON/.local/share/glib-2.0/schemas"
[ ! -d "$GSETTINGS_SCHEMA_DIR" ] && mkdir -p "$GSETTINGS_SCHEMA_DIR"
if [ ! -f "$GSETTINGS_SCHEMA_DIR/gschemas.compiled" ]; then
cp /usr/share/glib-2.0/schemas/*.xml "$GSETTINGS_SCHEMA_DIR"
# remove the deprecated schema entry so that keys are now in the main schema
sed -i "/org.gnome.settings-daemon.plugins.xsettings.deprecated/d" "$GSETTINGS_SCHEMA_DIR/org.gnome.settings-daemon.plugins.xsettings.gschema.xml"
sed -i "0,/<\/schema>/{//d;}" "$GSETTINGS_SCHEMA_DIR/org.gnome.settings-daemon.plugins.xsettings.gschema.xml"
# recompile
$SNAP/usr/bin/glib-compile-schemas "$GSETTINGS_SCHEMA_DIR"
fi
fi

export XDG_DATA_DIRS="$SNAP/usr/share:$XDG_DATA_DIRS"

# native comp needs to find as etc and this comes from within the snap
Expand Down
3 changes: 2 additions & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ parts:
stage-packages:
- gcc-10 # for tree-sitter
- g++-10 # for tree-sitter
- gnome-settings-daemon-common # for antialiasing gsetting
- gvfs
- ibus-gtk3
- libasound2
Expand Down Expand Up @@ -135,6 +134,8 @@ parts:
- libgdk-pixbuf2.0-0
- libgif7
- libgl1
- libglib2.0-0
- libglib2.0-bin
- libglvnd0
- libglx0
- libgpm2
Expand Down

0 comments on commit 84a5da0

Please sign in to comment.