aboutsummaryrefslogtreecommitdiff
path: root/bin/gnome-set-config
blob: 983bdee2793828759664bf2108499f170f607d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# Sets my preferred Gnome config.
# Find existing bindings with:
#   for e in $(gsettings list-schemas  | grep bind); do gsettings list-recursively $e; done

NUM_WORKSPACES=9

gsettings set org.gnome.mutter dynamic-workspaces false
gsettings set org.gnome.desktop.wm.preferences num-workspaces $NUM_WORKSPACES

for i in $(seq 1 $NUM_WORKSPACES); do
    gsettings set org.gnome.shell.keybindings switch-to-application-$i '[]'
    gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-$i "['<Super>$i']"
    gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-$i   "['<Shift><Super>$i']"
done

# This configuration is not present in gsettings; we need to fall back to dconf
bindings="emacs org-mode move-windows"
keybindings_key="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings"
keybindings=$(echo $bindings | awk -v key="$keybindings_key" '{for(i=1;i<=NF;i++) printf("'\''" key "/" $i "/'\''%s", (i==NF ? "" : ","))}')
keybindings="[$keybindings]"

dconf write "$keybindings_key" "$keybindings"

dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emacs/binding "'<Shift><Super>e'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emacs/command "'emacsclient -c'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emacs/name "'Emacs'"

dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/org-mode/binding "'<Shift><Super>o'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/org-mode/command "'emacsclient -e \"(prot-window-popup-org-capture)\"'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/org-mode/name "'org-capture'"

dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move-windows/binding "'<Shift><Super>m'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move-windows/command "'/home/rul/bin/gnome-move-windows'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move-windows/name "'move-windows'"
nihil fit ex nihilo