I'm learning about bash script by writing one to setup all (or most of) my Ubuntu 18.04 customization. One of these are my keyboard shortcuts.
I'm using this answer strategy to config the hotkeys. However I observed it is accepting just the first 8 custom shortcuts I setup.
I mean, the hotkeys that I store between custom0
and custom7
slots had been saved, but all others ignored.
Do someone have a clue about what could been happening?
This is the scripting I'm using:
# Terminal
$(dconf write /org/gnome/terminal/legacy/keybindings/next-tab "'<Alt>w'")
$(dconf write /org/gnome/terminal/legacy/keybindings/prev-tab "'<Alt>a'")
# Music
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/play "'<Super>KP_Separator'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/next "'<Super>KP_Decimal'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/previous "'<Super>KP_Divide'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/volume-up "'<Super>KP_Add'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/volume-down "'<Super>KP_Subtract'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/volume-mute "'<Super>KP_Multiply'")
# Launch
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/www "'<Primary><Alt>c'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/home "'<Primary><Alt>f'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/binding "'<Primary><Alt>k'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/command "'gnome-control-center keyboard'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/name "'Shortcuts settings'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/binding "'<Primary><Alt>equal'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/command "'env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/gnome-calculator_gnome-calculator.desktop /snap/bin/gnome-calculator %U'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/name "'Calculator'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/binding "'<Primary><Alt>a'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/command "'atom ~/.fragatron'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/name "'Atom'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/binding "'<Primary><Alt>y'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/command "'/opt/google/chrome/google-chrome --profile-directory=Default --app-id=eeaafbmfeofhhjpjklgoobllogkjdgap'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/name "'YouTube Music'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/binding "'<Primary><Alt>z'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/command "'/opt/google/chrome/google-chrome --profile-directory=Default --app-id=lilmhcaoekddncecbphbjdbjccdbneij'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/name "'Google Tradutor'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/binding "'<Primary><Alt>g'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/command "'/opt/google/chrome/google-chrome --profile-directory=Default --app-id=mmlonmkggdiafehdajlempfflcdfddna'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/name "'GitHub'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/binding "'<Primary><Alt>KP_Separator'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/command "'toggle-sound-output'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/name "'Toggle sound-output'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8/binding "'<Primary><Shift>KP_1'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8/command "'profile-info name'")
$(dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8/name "'Profile Name'")
To solve this, just overwrite the
custom-keybindings
attribute with the whole list of custom shortcuts:I tried this even using different names (non-numbered) for each custom keybinding and it worked without problems.