Gsettigs和dconf设置热键 [英] Gsettigs and dconf to set hotkey
问题描述
您好
我需要在ubuntu 12.10中设置一个热键,我使用
Hello
I need to set a hotkey in ubuntu 12.10, i use
gsettings(dconf)
gsettings(dconf)
~$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ binding '<Primary><Alt>s'
~$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ binding '<Primary><Alt>s'
~$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ command 'gnome-terminal'
但是当我看到这个模式时,我只会看到
but when i watch this schema i just see
~$ gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings
~$ @as []
但是当我使用dconf来查看此架构时
but when i use dconf to see this schema
~$ dconf list /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/
binding
command
我做错了什么? 谢谢.
what i am doing wrong? Thank you.
推荐答案
您忘记设置父键custom-keybindings
的值,该键的类型为@as[]
.首先使用以下命令检查其是否为空:
You forgot to set the value for the parent key: custom-keybindings
which is of type @as[]
. First check if it's empty with:
gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings
如果为空:[]
,请运行:
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/']"
如果不为空,则必须将现有值添加到上述命令中(值必须用单引号引起来,并用逗号+空格分隔,例如['val1', 'val2', 'val3']
).然后运行:
If it's not empty you will have to add the existing values to the above command (values must be surrounded by single quotes and separated by comma + space, like ['val1', 'val2', 'val3']
). And then run:
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/custom2/ binding '<Primary><Alt>s'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/custom2/ command 'gnome-terminal'
这篇关于Gsettigs和dconf设置热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!