34 lines
956 B
Text
34 lines
956 B
Text
|
|
#!/bin/sh
|
||
|
|
|
||
|
|
# Make the `GSettings` schemas of all user-installed GNOME Shell extensions
|
||
|
|
# visible to a plain `gsettings`, by symlinking the *.gschema.xml files
|
||
|
|
# into the user schema directory and compiling them
|
||
|
|
#
|
||
|
|
# Idempotent: Re-running refreshes the links, prunes dangling ones
|
||
|
|
# (e.g., from removed extensions), and recompiles
|
||
|
|
|
||
|
|
set -eu
|
||
|
|
|
||
|
|
|
||
|
|
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||
|
|
|
||
|
|
EXTENSIONS_DIR="$XDG_DATA_HOME/gnome-shell/extensions"
|
||
|
|
SCHEMAS_DIR="$XDG_DATA_HOME/glib-2.0/schemas"
|
||
|
|
|
||
|
|
|
||
|
|
mkdir -p "$SCHEMAS_DIR"
|
||
|
|
|
||
|
|
|
||
|
|
# Prune symlinks whose target no longer exists
|
||
|
|
find "$SCHEMAS_DIR" -maxdepth 1 -type l ! -exec test -e {} \; -exec rm -v -- {} \;
|
||
|
|
|
||
|
|
|
||
|
|
# Link every schema shipped by an extension
|
||
|
|
for xml in "$EXTENSIONS_DIR"/*/schemas/*.gschema.xml; do
|
||
|
|
[ -e "$xml" ] || continue # because the glob does not expand if empty
|
||
|
|
echo " $(basename "$xml")"
|
||
|
|
ln -sf -- "$xml" "$SCHEMAS_DIR/"
|
||
|
|
done
|
||
|
|
|
||
|
|
|
||
|
|
glib-compile-schemas "$SCHEMAS_DIR"
|