dotfiles/.local/bin/dconf-verify

43 lines
1.1 KiB
Text
Raw Normal View History

2026-08-03 14:30:55 +02:00
#!/bin/sh
# List GNOME `dconf` keys that are live but not described by ~/.config/gnome-settings/*.ini
set -eu
# Keep in sync with the `RESET_PATHS` in ~/.local/bin/gnome-restore
# (Note: The `$FILTER` below is a bit more generic than the `RESET_PATHS`)
FILTER='^(org/gnome/|org/gtk/|org/freedesktop/(ibus|tracker)/|ca/desrt/|system/)'
GNOME_CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/gnome-settings"
flat() {
awk '/^\[/ { s = substr($0, 2, length($0) - 2); next }
/^[A-Za-z0-9][A-Za-z0-9_-]*=/ { i = index($0, "="); print s "/" substr($0, 1, i - 1) }'
}
live=$(mktemp)
managed=$(mktemp)
trap 'rm -f "$live" "$managed"' EXIT INT TERM
dconf dump / | flat | grep -E "$FILTER" | sort -u > "$live"
find "$GNOME_CFG_DIR" -maxdepth 2 -type f -name '*.ini' -exec cat {} + \
| sed "s|/home/user|$HOME|g" \
| flat | grep -E "$FILTER" | sort -u > "$managed"
echo ""
echo "== Live keys NOT in the ~/.config/gnome-settings/*.ini files =="
comm -23 "$live" "$managed"
echo ""
echo ""
echo "== Keys in the ~/.config/gnome-settings/*.ini files but NOT live =="
comm -13 "$live" "$managed"
echo ""