web-dev-qa-db-fra.com

Gsettings et dconf

Salut
Je dois définir un raccourci clavier dans Ubuntu 12.10, j'utilise:

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' 

Mais quand je regarde ce schéma avec gsettings je vois juste:

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

Mais quand j'utilise dconf pour voir ce schéma:

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

Qu'est-ce que je fais mal?

8
minaevmike

Commencez par créer custom2:

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

(Où others est un raccourci pour les autres raccourcis clavier déjà définis. Juste pour vous assurer de ne pas les supprimer.)

Maintenant que c'est hors de propos, configurez votre 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'
1
edwin

Utilisez ces commandes:

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
user153137