aboutsummaryrefslogtreecommitdiff
path: root/bin/gnome-set-config
blob: 291d1fd569cb6673ed433f91a4a977fbad62ac94 (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
36
37
38
39
40
41
42
#!/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

# Disable the default <Super>p. I don't use it, and it's disruptive when I accidentally trigger it.
gsettings set org.gnome.mutter.keybindings switch-monitor '[]'

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 rofi"
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 "'gnome-move-windows'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move-windows/name "'move-windows'"

dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/binding "'<Super>space'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/command "'rofi -show window'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/name "'rofi'"
nihil fit ex nihilo