Advertisement
wja

get-unity-keyboard-shortcuts.sh

wja
May 4th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. #!/bin/bash
  2. # Returns the configuration of all Unity custom keyboard shortcuts.
  3.  
  4. # Definitions.
  5. list="org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
  6. details="org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/"
  7.  
  8. # Find the names of all the shortcuts.
  9. # Won't work if they're not named like "custom0", "custom1", etc.
  10. customs="$(gsettings get $list | grep -oE "custom"'[0-9]{1,10}')"
  11.  
  12. # Errors if there aren't any shortcuts.
  13. if [[ -z "$customs" ]]; then
  14.     echo "No custom keyboard shortcuts."
  15.     exit 1
  16. fi
  17.  
  18. # Tells you the schema and path of every shortcut.
  19. echo -n "$list "
  20. gsettings get $list
  21.  
  22. # Returns the configuration of each shortcut.
  23. for i in $customs; do
  24.     echo
  25.     echo $i
  26.     gsettings list-recursively ${details}${i}/
  27. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement