0

When I tried to list the available custom keybindings using gsettings command

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings

I got the error message saying,

No such key 'custom-keybindings'

I graphically checked my custom keyboard shortcuts and it was empty. So I thought this is normal. So I tried to add new keybinding using

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

Again the same error returned. I am using Ubuntu 12.04 in virtualbox. Doesn't it comes with the key custom-keybindings? How can I add a new custom-keybindingusing gsettings?

1 Answers1

1

Jacob Vlijm's python script was very useful. I am sharing a shell script to do this if someone may find it useful.

#!/bin/sh
ls -d ~/.gconf/desktop/gnome/keybindings/*/
    if [[ `echo $?` == 2 ]]; then
        shortCutNumber=0
        else
        shortCutNumber=$((`ls -d ~/.gconf/desktop/gnome/keybindings/*/ | tail -c 3 | head -c 1`+1))
    fi
    echo -e '<?xml version="1.0"?>' > %gconf.xml 
    echo -e '\t<gconf>' | tee -a %gconf.xml 
    echo -e '\t<entry name="action" mtime="`date +%s`" type="string">' | tee -a %gconf.xml 
    echo -e '\t\t<stringvalue>gnome-terminal -e '`pwd`/LanChat.sh'</stringvalue>' | tee -a %gconf.xml 
    echo -e '\t</entry>' | tee -a %gconf.xml 
    echo -e '\t<entry name="name" mtime="`date +%s`" type="string">' | tee -a %gconf.xml 
    echo -e '\t\t<stringvalue>QryptoChat</stringvalue>' | tee -a %gconf.xml 
    echo -e '\t</entry>' | tee -a %gconf.xml
    echo -e '\t<entry name="binding" mtime="`date +%s`" type="string">' | tee -a %gconf.xml 
    echo -e '\t\t<stringvalue>&lt;Alt&gt;q</stringvalue>' | tee -a %gconf.xml 
    echo -e '\t</entry>' | tee -a %gconf.xml 
    echo -e '</gconf>' | tee -a %gconf.xml 
    mkdir ~/.gconf/desktop/gnome/keybindings/custom$shortCutNumber
    mv %gconf.xml ~/.gconf/desktop/gnome/keybindings/custom$shortCutNumber/

The script first checks whether there exists any custom shortcuts already. And then creates the %gconf.xml file inside a new custom folder with the necessary settings.