Last active
June 8, 2024 09:06
-
-
Save peterrus/e59a96688a4d49ee3d9302c0d3ff5fdd to your computer and use it in GitHub Desktop.
Backs up and restores gnome3 keybindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Backs up and restores gnome3 keybindings | |
# Tested with Gnome 3.36.8 | |
# by peterrus | |
set -e | |
mkdir -p gnome3-keybind-backup | |
if [[ $1 == 'backup' ]]; then | |
dconf dump '/org/gnome/desktop/wm/keybindings/' > gnome3-keybind-backup/keybindings.dconf | |
dconf dump '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/' > gnome3-keybind-backup/custom-values.dconf | |
dconf read '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings' > gnome3-keybind-backup/custom-keys.dconf | |
echo "backup done" | |
exit 0 | |
fi | |
if [[ $1 == 'restore' ]]; then | |
dconf reset -f '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/' | |
dconf reset -f '/org/gnome/desktop/wm/keybindings/' | |
dconf load '/org/gnome/desktop/wm/keybindings/' < gnome3-keybind-backup/keybindings.dconf | |
dconf load '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/' < gnome3-keybind-backup/custom-values.dconf | |
dconf write '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings' "$(cat gnome3-keybind-backup/custom-keys.dconf)" | |
echo "restore done" | |
exit 0 | |
fi | |
echo "parameter 0: [backup|restore]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment