Watch
1
0
Fork
You've already forked dotfiles
0

Add configuration for GNOME

This commit is contained in:
Alexander Hess 2026-08-03 14:30:55 +02:00
commit 5166031fa2
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
2 changed files with 325 additions and 0 deletions

71
.local/bin/restore-gnome Executable file
View file

@ -0,0 +1,71 @@
#!/bin/sh
# Restore the Gnome settings from ~/.config/gnome-settings/*.ini
#
# `dconf load` merges into the existing state, implying
# that keys removed from the *.ini files would still be active
# => Reset the subtrees we fully manage first,
# which makes the resulting state deterministic
set -eu
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
SETTINGS_DIR="$XDG_CONFIG_HOME/gnome-settings"
# Subtrees fully described by the *.ini files
RESET_PATHS="
/org/gnome/desktop/app-folders/
/org/gnome/desktop/notifications/
/org/gnome/desktop/wm/keybindings/
/org/gnome/mutter/keybindings/
/org/gnome/settings-daemon/plugins/media-keys/
/org/gnome/shell/extensions/
/org/gnome/shell/keybindings/
"
if ! command -v dconf >/dev/null 2>&1; then
echo "dconf is not installed => Nothing to do" >&2
exit 0
fi
if [ ! -d "$SETTINGS_DIR" ]; then
echo "No settings found at: $SETTINGS_DIR" >&2
exit 1
fi
echo "Backing up the current GNOME settings to: /tmp/gnome-settings-backup.ini"
dconf dump / > /tmp/gnome-settings-backup.ini
echo "Resetting the managed subtrees"
for path in $RESET_PATHS; do
echo " $path"
dconf reset -f "$path"
done
echo "Loading the settings from: $SETTINGS_DIR"
for file in "$SETTINGS_DIR"/*.ini; do
[ -e "$file" ] || continue # because the glob does not expand if empty
echo " $(basename "$file")"
dconf load / < "$file"
done
echo ""
echo "Log out and back in for all changes to take effect"
echo ""