Gsettings和dconf


9

您好
我需要在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

我究竟做错了什么?


请问您为什么要使用dconfgsettings?有许多简便的方法可以创建键盘快捷键/热键。
赛斯

因为我需要在安装后脚本中设置热键。这是什么方式?
minaevmike

嗯,恐怕他们不能用于安装后脚本。
赛斯

为什么不?在ubuntu 12.04中,我使用gconftool-2,但在12.10中它不起作用
minaevmike 2013年

Answers:


2

使用以下命令:

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

1

首先尝试创建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'
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.