我正在通过编写一个脚本来设置我的所有(或大部分)我的 Ubuntu 18.04 定制来学习 bash 脚本。其中之一是我的键盘快捷键。
我正在使用这个答案策略来配置热键。但是我观察到它只接受我设置的前 8 个自定义快捷方式。我的意思是,我存储在custom0
和custom7
插槽之间的热键已被保存,但所有其他的都被忽略了。
有人知道可能发生了什么吗?
这是我正在使用的脚本:
# 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'")
要解决这个问题,只需
custom-keybindings
使用整个自定义快捷方式列表覆盖属性:我什至对每个自定义键绑定都使用了不同的名称(未编号),并且它没有问题地工作。