I'm trying to make an application indicator that toggles the launcher mode: either normal or auto-hide. Right now I can toggle the gconf key


which is either 0 or 1. However, the launcher doesn't actually change its mode. How can I make unity recognize that the gconf key value changed?


With the inclusion of Gnome 3, starting in Ubuntu 11.10 the gconf mechanism is deprecated and while some apps still honor it, Unity is not one of them.

Gconf was replaced by gsettings, so to do what you want you need to :

  • Figure out which path and key you need to set, and which value you need to set it to.

This can be done with the gsettings command. To see all the keys use gsettings list-recursively. In this case, I did gsettings list-recursively |grep hide and I came up with the com.canonical.Unity2d.Launcher schema, the key is hide-mode.

You can test this by doing

gsettings set com.canonical.Unity2d.Launcher hide-mode 1

Change the 1 to 0 to see the different effects the key has.

  • In your Python code, use Gio.settings to manipulate gsettings directly.

Here's an example:

from gi.repository import Gio
launcher_settings = Gio.Settings.new("com.canonical.Unity2d.Launcher")
launcher_settings.set_int("hide-mode", 1)

I'm not sure if you need to use set_int or set_boolean. You should experiment with these a bit to get the results you want.

  • thank you! I replaced set_string with set_int and everything worked. for some reason, the unity launcher settings is in gconf, not gsettings – functionptr Jun 24 '12 at 17:40

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.