#!/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 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 "['$i']" gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-$i "['$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 "'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 "'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 "'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 "'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'"