Skip to content

Instantly share code, notes, and snippets.

@JonasGroeger
Created December 16, 2015 21:34
Show Gist options
  • Save JonasGroeger/94cfa1071fa12572f465 to your computer and use it in GitHub Desktop.
Save JonasGroeger/94cfa1071fa12572f465 to your computer and use it in GitHub Desktop.
Disables Ubuntu shortcuts that clash with IntelliJ Idea (and probably other Jetbrain products). Creates a backup file to restore the previous settings. To not have some shortcuts disabled, comment them out in the `KEYS` array.
#!/bin/bash
set -euo pipefail
# Disables Ubuntu shortcuts that clash with IntelliJ Idea (and probably other
# Jetbrain products).
#
# Creates a backup file to restore the previous settings. To not have some
# shortcuts disabled, comment them out in the `KEYS` array.
#
# Tested on : Ubuntu 15.10
# Author : Jonas Gröger <[email protected]>
readonly BACKUP_FILE="undo-fix-shortcuts-$(date +%s%N).sh"
readonly KEYS=(
"/org/gnome/desktop/wm/keybindings/toggle-shaded"
"/org/gnome/settings-daemon/plugins/media-keys/screensaver"
"/org/gnome/settings-daemon/plugins/media-keys/terminal"
"/org/gnome/desktop/wm/keybindings/switch-to-workspace-down"
"/org/gnome/desktop/wm/keybindings/switch-to-workspace-up"
"/org/gnome/desktop/wm/keybindings/switch-to-workspace-left"
"/org/gnome/desktop/wm/keybindings/switch-to-workspace-right"
"/org/gnome/desktop/wm/keybindings/begin-move"
"/org/gnome/desktop/wm/keybindings/begin-resize"
# To disable resetting a value, just comment out the line
)
readonly DISABLED_VALUE="['disabled']"
main() {
# Make backup
printf "#!/bin/bash\n" >> "$BACKUP_FILE"
for key in "${KEYS[@]}"; do
local value
value=$(dconf read "$key")
printf "dconf write \"%s\" \"%s\"\n" "$key" "$value" >> "$BACKUP_FILE"
done
# Disable all Ubuntu shortcuts
for key in "${KEYS[@]}"; do
dconf write "$key" "$DISABLED_VALUE"
done
}
main
@tatome
Copy link

tatome commented Feb 16, 2016

Might want to add this:
gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "[]" # disable Alt+F1

Alt+F1 is used in IntelliJ IDEA to scroll to the file currently open in the main window in the project view. By default gnome catches this shortcut and goes into the Activities view (or whatever it's called). Unfortunately, this shortcut can't be configured using the usual tool, which is very confusing.

(see this question on SO)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment