Gsettings 和 dconf

Gsettings 和 dconf

您好,
我需要在 ubuntu 12.10 中设置热键,我使用:

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'<br>  
 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'<br> 
 gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ command 'gnome-terminal' 

但是当我使用 gsettings 查看这个模式时,我只看到:

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings
@as []

但是当我使用 dconf 查看这个模式时:

dconf list /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/
 binding
 command

我究竟做错了什么?

答案1

使用这些命令:

dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/name
dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/binding
dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/command

答案2

首先尝试创建custom2

gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['others', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/']"

(其中others是已定义的其他键绑定的简写。只是为了确保您不会删除它们。)

现在一切都已经完成了,请配置您的custom2

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'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ name 'Open a terminal window'

相关内容