hamidaddin
June 23rd, 2009, 12:23 PM
This is how to toggle gconf keys through a shell script (or command line):
You can get the key address of the item you want to change by running gconf from the terminal or ALT+F2
In my case, I want to toggle the touchpad on and off when I am typing. I searched in gconf for "touchpad" and found the "touchpad_enabled" key. When the key is highlighted, a Key Documentation appears in the lower panel. Under Key name I found and copied the full address of the key that I can access through the terminal using the gconftool (In this case the full name is: /desktop/gnome/peripherals/mouse/touchpad_enabled).
In the terminal:
Getting the current key value:
gconftool --get /desktop/gnome/peripherals/mouse/touchpad_enabled
Assigning a new value (you have to put the type. In this case Boolean):
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled true
A simple shell script to toggle touchpad on and off would look like this:
#!/bin/bash
key_value=$(gconftool --get /desktop/gnome/peripherals/mouse/touchpad_enabled)
echo $key_value | grep "false"
if [[ $? -eq 0 ]] ; then
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled true
else
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled false
fi
You can then assign this to a keyboard shortcut for quick toggling.
Hope someone find this useful.
You can get the key address of the item you want to change by running gconf from the terminal or ALT+F2
In my case, I want to toggle the touchpad on and off when I am typing. I searched in gconf for "touchpad" and found the "touchpad_enabled" key. When the key is highlighted, a Key Documentation appears in the lower panel. Under Key name I found and copied the full address of the key that I can access through the terminal using the gconftool (In this case the full name is: /desktop/gnome/peripherals/mouse/touchpad_enabled).
In the terminal:
Getting the current key value:
gconftool --get /desktop/gnome/peripherals/mouse/touchpad_enabled
Assigning a new value (you have to put the type. In this case Boolean):
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled true
A simple shell script to toggle touchpad on and off would look like this:
#!/bin/bash
key_value=$(gconftool --get /desktop/gnome/peripherals/mouse/touchpad_enabled)
echo $key_value | grep "false"
if [[ $? -eq 0 ]] ; then
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled true
else
gconftool --type Boolean --set /desktop/gnome/peripherals/mouse/touchpad_enabled false
fi
You can then assign this to a keyboard shortcut for quick toggling.
Hope someone find this useful.