-
-
Save termnml/668312bf6c1f69c76d230554157a7647 to your computer and use it in GitHub Desktop.
Backs up and restores gnome3 keybindings
This file contains hidden or 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 | |
set -x | |
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 | |
dconf dump '/org/gnome/shell/keybindings/' > gnome3-keybind-backup/shell-keybindings.dconf | |
dconf dump '/org/gnome/mutter/keybindings/' > gnome3-keybind-backup/mutter-keybindings.dconf | |
dconf dump '/org/gnome/mutter/wayland/keybindings/' > gnome3-keybind-backup/mutter-wayland-keybindings.dconf | |
echo "backup done" | |
exit 0 | |
fi | |
if [[ $1 == 'restore' ]]; then | |
dconf reset -f '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/' | |
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)" | |
dconf reset -f '/org/gnome/desktop/wm/keybindings/' | |
dconf load '/org/gnome/desktop/wm/keybindings/' < gnome3-keybind-backup/keybindings.dconf | |
dconf reset -f '/org/gnome/shell/keybindings/' | |
dconf load '/org/gnome/shell/keybindings/' < gnome3-keybind-backup/shell-keybindings.dconf | |
dconf reset -f '/org/gnome/mutter/keybindings/' | |
dconf load '/org/gnome/mutter/keybindings/' < gnome3-keybind-backup/mutter-keybindings.dconf | |
dconf reset -f '/org/gnome/mutter/wayland/keybindings/' | |
dconf load '/org/gnome/mutter/wayland/keybindings/' < gnome3-keybind-backup/mutter-wayland-keybindings.dconf | |
echo "restore done" | |
exit 0 | |
fi | |
echo "usage: gnome3_keybind_backup.sh <backup|restore>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment