set-recommended-gnome-shell-settings: use 'gsettings' instead of 'dconf'

dconf can't reliable get default values(?)

According to https://bugzilla.redhat.com/show_bug.cgi?id=1541448 the dconf
default value might also differ from the gsettings default value(?)

I did not find a way to differentiate between "use default value" and the actual
default value - so running the script might change some settings from "use
default value" to the actual default value.

IIUC 'gsettings' require the gsettings daemon to run, while 'dconf' is lower
level and modify the database directly.

Fixes #121
This commit is contained in:
Ole Jørgen Brønner
2019-06-16 15:37:57 +02:00
parent e73e6e2d26
commit 4c89ef385a
+14 -13
View File
@@ -14,43 +14,44 @@ if [[ $GNOME_SHELL_VERSION > "GNOME Shell 3.3" ]]; then
fi
function set-with-backup {
DPATH=$1
SCHEMA=$1
KEY=$2
TARGET_VAL=$3
if [[ $USE_OVERRIDE_SCHEMA == true ]]; then
# Gnome 3.3x doesn't use the override path
# https://gitlab.gnome.org/GNOME/gnome-shell/commit/393d7246cc176cbe8200a62bd661830597ca2fb6
DPATH=$(echo $DPATH |
sed "s|^/org/gnome/shell/overrides/|/org/gnome/mutter/|g")
SCHEMA=$(echo $SCHEMA |
sed "s|^org\.gnome\.shell\.overrides|org.gnome.mutter|g")
fi
TARGET_VAL=$2
CURRENT_VAL=$(dconf read $DPATH)
CURRENT_VAL=$(gsettings get $SCHEMA $KEY)
if [[ "$CURRENT_VAL" == "$TARGET_VAL" ]]; then
return
fi
echo "dconf write $DPATH $CURRENT_VAL" >> $RESTORE_SETTINGS_SCRIPT
echo "gsettings set $SCHEMA $KEY $CURRENT_VAL" >> $RESTORE_SETTINGS_SCRIPT
dconf write $DPATH $TARGET_VAL
echo "Changed $DPATH from '$CURRENT_VAL' to '$TARGET_VAL'"
gsettings set $SCHEMA $KEY $TARGET_VAL
echo "Changed $SCHEMA $KEY from '$CURRENT_VAL' to '$TARGET_VAL'"
}
##### Recommended settings
set-with-backup /org/gnome/mutter/auto-maximize false
set-with-backup org.gnome.mutter auto-maximize false
# Multi-monitor support is much more complete with workspaces spanning monitors
set-with-backup /org/gnome/shell/overrides/workspaces-only-on-primary false
set-with-backup org.gnome.shell.overrides workspaces-only-on-primary false
# PaperWM currently works best using static workspaces
set-with-backup /org/gnome/shell/overrides/dynamic-workspaces false
set-with-backup org.gnome.shell.overrides dynamic-workspaces false
# We make no attempt at handing edge-tiling
set-with-backup /org/gnome/shell/overrides/edge-tiling false
set-with-backup org.gnome.shell.overrides edge-tiling false
# Attached modal dialogs isn't handled very well
set-with-backup /org/gnome/shell/overrides/attach-modal-dialogs false
set-with-backup org.gnome.shell.overrides attach-modal-dialogs false
echo