Is there a way to access the variables to edit via bash (or other libraries with bash or python)? Similar to how you can use 'gconftool-2' in bash to edit properties that would update them after edited.

For example, I would like to run a script to disable 'the file manager to handle the desktop' by terminal (bash or python) instead of opening this window each time.

I also have tried making 'show_desktop' to false in nautilus in gconf-editor but that doesn't do anything.

I am using Ubuntu 11.10 and compiz as the window manager on Gnome (2 I believe, or whatever comes with 11.10).


We're going to use Gio to get the Base Key (the category the value is at). Once we get that value we're going to set a CheckBox on it to change the value. We then setup various signals to listen for changes in the setting and CheckBox. I know it's not the desktop one but you can plug it into the BASE_KEY. By the way, you shouldn't try and use GConf in GNOME 3, because it's been deprecated.

from gi.repository import Gio, Gtk

class GSettingsTest(object):
    BASE_KEY = "org.gnome.nautilus.preferences"
    def __init__(self):
        # Make a check button to change the value.
        settings = Gio.Settings(self.BASE_KEY)
        change_check = Gtk.CheckButton("Always Use Browser")
        change_check.set_active (settings.get_boolean("always-use-browser"))
        settings.connect("changed::always-use-browser", self.on_changed, change_check)
        change_check.connect('toggled', self.on_check_clicked, settings)

        window = Gtk.Window(type = Gtk.WindowType.TOPLEVEL)
        window.set_title("Change Nautilus")
        window.connect("delete-event", Gtk.main_quit)

    def on_changed(self, settings, key, change_check):

    def on_check_clicked(self, button, settings):
        settings.set_boolean("always-use-browser", button.get_active())

if __name__ == '__main__':
    app = GSettingsTest()

What the program looks like, with the settings synced.

  • Actually you did lead me to it. The actual key is 'show-desktop-icons'. Access it from 'org.gnome.desktop.background' -> show-desktop-icons. Thanks for your help!
    – user654628
    Feb 11 '12 at 19:28
  • No Problem:) Glad I could help Feb 18 '12 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.