I was sitting here this afternoon trying to come up with something to blog about. Looking at some of the wiki work I’ve done recently I realize I’ve made a good use of the gconfool-2 for customizing the GNOME Desktop all from the shell. I thought I’d share some of the basic command structures with you.
Basically what gconftool-2 will do is allow you to set GNOME environmet tweaks (font sizes, sound mixer settings, taskbar size/location, etc) from the shell vs using the graphical tool.
gconftool-2 examples
Below is an example of using the gconftool-2 to set the default font sizes to 8, as I’ve done on the EeePC.
gconftool-2 --set /apps/nautilus/preferences/desktop_font --type string "Sans 8"
gconftool-2 --set /desktop/gnome/interface/document_font_name --type string "Sans 8"
gconftool-2 --set /desktop/gnome/interface/font_name --type string "Sans 8"
gconftool-2 --set /apps/metacity/general/titlebar_font --type string "Sans Bold 8"
gconftool-2 --set /desktop/gnome/interface/monospace_font_name --type string "Monospace 8"
The above commands are the equivalent of launching the gconf-editor (ALT-F2 : gconf-editor), navigating to the paths listed above and changing the listed values. While I am very grateful that we do have a graphical tool for editing these things, you tell me which is faster?
gconftool-2 basics
The basic structure of using the gconftool-2 is the following:
gconftool-2 --set /path/to/setting --type <type> "value"
The /path/to/setting can be found using the graphical tool (unless someone can tell me an alternate method). The type can also be found in the same place. For example, let’s say I want to change toggle the value of locking the screen when the screensaver is in use. I can open the gconf-editor GUI tool, navigate through its menu tree “apps > gnome-screensaver” and find the “lock_enabled” value. Normally, by checking or unchecking this box we’d toggle the value.
Using gconftool-2 we can achieve the same thing using:
gconftool-2 --set /apps/gnome-screensaver/lock_enabled --type bool 1"
Now I understand that at this point we aren’t technically any faster because we had to look it up in the GUI anyway, but once you’ve found it the first time you should be ahead of the game the second time. This is great for installing multiple machines, or simply if you reinstall your machine regularly and want to script your settings back into place.
As per the basic structure above we’re –setting a value, giving the path to what value we want to change, and then defining the type. In this case it is an off or on boolean value. In other cases, as with the examples above, it is a string that needs to be defined. You can find out what type of value (integer, boolean, string, etc) your item uses by double-clicking within the graphical application.
I have been able to find most values in the gconf-editor or gconftool-2. Everything from toggling the proper mixer for my volume settings to setting my taskbars to a specific size.
I hope these basic examples are enough to get some of you started.