A simple GUI for Unity-2D Settings (Ubuntu 11.04)

This is a very simple configuration tool I made to save time browsing folders and adding values in Gconf, or writing commands in the terminal to customize certain aspects of the new Unity-2D Desktop.

There’s not much to tweak under the current version of Unity-2D. However, there are certain times -Specially while I’m running Ubuntu on a VM- that I want to set the Launcher to be hidden or vice versa, and Compositing Manager makes it look way better (Near regular Unity) adding window edge shadows, transparency in the Dash and Alt-Tab Switching thumbnail previews.

Download (.deb Installer): Compatible only with 11.04 Natty Narwhal

An updated version for 11.10 oneiric can be found in this post and for 12.04 Precise LTS in this post.

Notes: If you click the compositing manager checkbox, hit “Alt+Tab” to refresh your desktop since by enabled-disabled you get a black screen.
The ‘Always Show’ option for the launcher is tricky to set when it’s hidden (A native bug in Unity-2D caused by the ‘use-strut’ gconf key), you can use “Super” or “Alt+F2” keyboard shortcuts to bring the launcher back in position.

The code:

#! /usr/bin/python

# 2D-Desktop Settings 1.0-5
# Small desktop configuration tool for Unity-2D (11.04)
#
# Copyright 2011-2012 by Mariano Chavero
#
# Distributed under de GNU/GPL V3
# Visit <http://www.gnu.org/licenses/> for more information.

import gtk, gconf

class Settings(gtk.Window):

    def label(self, text):
        box = gtk.HBox()
        lbl = gtk.Label(text)
        lbl.set_use_markup(True)
        lbl.set_alignment(0, 0.3)
        box.pack_start(lbl, False, False, 25)
        return box

    def Checkbox(self, text, key):
        client = gconf.client_get_default()

        box = gtk.HBox()
        bttn = gtk.CheckButton(text)
        bttn.set_active(client.get_bool(key))
        bttn.connect("toggled", self.on_Checkbox_toggled, client, key)
        box.pack_start(bttn, False, False, 50)
        return box

    def RadioButton(self, text, key, val, group):
        client = gconf.client_get_default()

        box = gtk.HBox()
        bttn = gtk.RadioButton(group, text)
        bttn.set_active(client.get_int(key) is val)
        bttn.connect("toggled", self.on_RadioButton_toggled, client, key, val)
        box.pack_start(bttn, False, False, 50)
        return box

    def on_Checkbox_toggled(self, widget, client, key):
        client.set_bool(key, widget.get_active())

    def on_RadioButton_toggled(self, widget, client, key, val):
        if not widget.get_active(): return
        client.set_int(key, val)

        # A desktop strut value is set, required by the Unity 2D Launcher
        client.set_bool("/desktop/unity-2d/launcher/use_strut", not bool(val))

    def Separator(self):
        return gtk.HSeparator()

        # Loads the system theme icon of your choice :)
    def theme_load(self, icon_name):
        t = gtk.icon_theme_get_default()
        return t.load_icon(icon_name, 48, 0)

    def __init__(self):
        gtk.Window.__init__(self, type=gtk.WINDOW_TOPLEVEL)
        self.set_resizable(False)
        self.set_border_width(10)
        self.set_title("2D-Desktop Settings")
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_icon(self.theme_load("gnome-fs-desktop"))
        self.connect("destroy", lambda q: gtk.main_quit())

        # Creates one group for our existant Radio Buttons
        rbttngroup = gtk.RadioButton(None)

        ### Layout ###
        Container = gtk.VButtonBox()

        Container.add(self.label("<b>Launcher Behaviour</b>"))

        Container.add(self.RadioButton("IntelliHide (Dodge with Windows)",
           "/desktop/unity-2d/launcher/hide_mode", 2, rbttngroup))

        Container.add(self.RadioButton("Auto Hide",
           "/desktop/unity-2d/launcher/hide_mode", 1, rbttngroup))

        Container.add(self.RadioButton("Always Show",
           "/desktop/unity-2d/launcher/hide_mode", 0, rbttngroup))

        Container.add(self.Separator())

        Container.add(self.label("<b>Unity 2D Dash</b>"))

        Container.add(self.Checkbox("Show Dash using the Super Key (Windows Logo)",
           "/desktop/unity-2d/launcher/super_key_enable"))

        Container.add(self.Separator())

        Container.add(self.label("<b>Desktop</b>"))

        Container.add(self.Checkbox("Enable Window Shadows and Transparency",
           "/apps/metacity/general/compositing_manager"))

        Container.add(self.Checkbox("Show Volumes and Devices",
           "/apps/nautilus/desktop/volumes_visible"))

        box = gtk.VBox()
        box.add(Container)
        self.add(box)
        self.show_all()
        gtk.main()
if __name__ == "__main__":
    Settings()

37 Comments on “A simple GUI for Unity-2D Settings (Ubuntu 11.04)”

  1. eugene says:

    nice! I like transparency option. Couldn’t make it work before. Everyone was saying that it works only in Unity 3d.

  2. […] Es una simple GUI que te permite configurar rápidamente: El modo de ocultación del panel lateral, Activar la composición de ventanas (transparencias y sombras), mostrar el Dash con la tecla Super o mostrar los volumenes en el escritorio. Se encuentra disponible como paquete .deb de 32 o 64 bits desde la web del desarrollador. […]

  3. Dylan says:

    Wow this is amazing and should really be included as part of Unity 2D. You should try and get in touch with those guys and talk about it being included.

    The compositing makes Unity 2D look sooo nice!

  4. […] es probable que para ver los ajustes de Ubuntu más avanzados y las aplicaciones en el futuro Descarga Unity 2D- Desktop Settings tweaker TweetCompartirArticulos Relacionados […]

  5. […] 包下载:墙外 / 墙内 ( 32 位/64 位 […]

  6. Sam says:

    nice work; I agree with Dylan

    auto hide is not working at all for me – but earlier it did work – for now finding out why is a distraction but I will look

  7. Joel says:

    Worked great! I got the launcher to always show which is why i downloaded it in the first place but the transparency doesn’t seen to work for me. ubuntu 11.04

  8. This tool identifies the desktop environment in use, then disables what’s not compatible for the session. Example: If Unity (3D not 2D) is running, the “Shadows and Transparency” button goes grayed out since it’s not required using Compiz.

    Users who find problems trying to set Unity-2D’s preferences just make sure “Unity-2D” is the session shown at the bottom of your login screen (Not “Ubuntu”). Otherwise, it will not be customizable. You can check out bug 747343 at launchpad.net for more details.

    Hope this helps :)

  9. SlugO says:

    Thanks for this tool! Had to switch to 2D because the 3D made it impossible to play any video on my machine.

    Is there a way to hide the volumes from Unity 2D launcher? I hate that together they take one third of the space even on 1920×1080.

  10. There is no easy way to do that unfortunately. The only way I know is by modifying it’s source code, but I wouldn’t recommend to mess around with that if you don’t feel comfortable doing so. Otherwise, the file is located at /usr/share/unity-2d/launcher:
    1.- Open the Terminal and type sudo gedit /usr/share/unity-2d/launcher/Launcher.qml
    2.- Create a backup of this file by simply using “Save As” and store it into your preferred directory. This will help if you like to bring those icons back in the future.
    3.- Now having the window selected, press Control F on your keyboard to launch the little search tool and type Component. You will get to the line 104 that reads Component.onCompleted All you have to do is delete the line that says “items.appendModel(devices);” , save changes, close the window and in the Terminal type killall unity-2d-launcher.

  11. Ricardo says:

    Great tool! I am having a little problem, on my ubuntu 11.04 instalation (installed with “apt-get install unity-2d”).

    I can not see the changes made on the settings reflected immediately on unity-2d. I need to logout/login to see my options activated. The same think happens when I use gconftool-2.

    What might be the problem? Do I need to install anything else?

  12. Log out, then make sure “Unity 2D” pops out in the list of “Sessions”. If is not there, then reinstall Unity-2D from the terminal. Otherwise, select Unity-2D, log in, then open gconf-editor (You can type gconf-editor in the terminal) then browse /desktop/unity-2d/launcher and try changing the values for “hide_mode” (Between 1 and 2 only). If this works good in gconf (Right away) then the problem is solved. :-)

  13. Pascal says:

    Thanks for this great tool, really saves times ! I just installed unity 2d on Natty because Unity 3d is definitely a way too buggy as Ubuntu Classic session anyway, so the only option for me choose Ubuntu Classic(no effects), and of course in this mode impossible to use any docks, so direction to Unity-2d, and I must admit that it is more stable, lightweight and as great as Unity-3d, anyway I don’t have choice now.

  14. Colin says:

    This tool is a god send! I have been looking for a way to keep the launcher from auto-hiding. Thank you for putting the work into this and posting it. I am curious what area this is modifying, and maybe I can modify those things myself, but otherwise this should hold me over until more settings are set up by the ubuntu team for the launcher.

  15. The settings for Unity-2D can be set using gconf-tool or gconf-editor at ‘/desktop/unity-2d/launcher’.
    Thank you and Thanks everyone for posting feedback about this tool.

  16. badrivarun says:

    You should add a close button – it makes the program look nicer.

  17. […] a un buen samaritano que desarrollo una pequeña, pero efectiva aplicación, el Sr. Mariano Chavero link del señor y su .deb para descarga, esta disponible para 32 y 64 bits, ¿bonito […]

  18. Miro says:

    When I maximize the window, left side is behind the launcher, so I dont see part of it, dont you know where should be a problem? Thanks in advance

  19. Tynach says:

    The tool seems broken – I can no longer use this to make my launcher stay visible (and match maximized windows). Also, I can no longer go into unity settings in gconf-editor/dconf-editor to get the same effect.

    Using the daily builds here, which is probably why.

  20. Thank you so much for this tool. It makes Unity a viable option for me.

  21. @MIro & @Tynach

    That sounds like you both use either Unidy-2D “Daily Build” or Oneiric instead of Natty. This tool works specifically with Unity-2D “Stable Version” on 11.04

    @Andrew Myers

    Thanks for your feedback :)

  22. Joseph says:

    Thank you for this tool! Very much appreciated

  23. Dulanja says:

    Thanks a lot! A really helpful tool :) I have been searching how to turn off the auto hide and found a link to your page in here http://askubuntu.com/questions/29553/how-can-i-configure-unity

  24. Laurens Winkelhagen says:

    I had a problem with this tool to make the launcher auto-hide (it stayed visible and my windows didn’t adjust accordingly).

    The problem was that the launcher options were disabled, with dodge windows checked. To fix the problem I went to gconf-editor –> /desktop/unity-2d/launcher. Here I found the hide_mode key was ‘missing’. Finally I decided to just add this key (right-click) with the (integer) value 2. This did the trick for me!

    Thank you for putting me on the right track.

  25. sikander3786 says:

    Don’t know if work is going on for improving this GUI and making it compatible with Oneiric. We’ve just updated the script and made it compatible with 11.10 as well. Changelog and download link:

    http://www.tuxgarage.com/2011/10/gui-for-changing-unity-2d-settings.html

  26. […] Deb 包下载:作者主页 (被墙) […]

  27. This is great since I don’t need to grab a pot holder or towel to open the lid. A crock pot that can be removed from the heating element (or base) is helpful for browning meats. cup of organic beef juice (grease-extracted), preferably left-over from cooking a roast or prime rib.

  28. […] Chavero has made “A simple GUI for Unity-2D Settings”: https://marianochavero.wordpress.com/2011/04/20/a-simple-gui-for-unity-2d-settings-ubuntu-11-04/ This may not answer your question but might help decrypting the options in […]

  29. […] If I got you right this might be the solution for your question: In gconf-editor enable “use_strut” in Unity 2D’s settings (desktop -> unity-2d -> launcher). In addition Mariano Chavero has made “A simple GUI for Unity-2D Settings”: https://marianochavero.wordpress.com/2011/04/20/a-simple-gui-for-unity-2d-settings-ubuntu-11-04/ […]

  30. […] How do I con­fi­gure Unity 2D? A simple GUI for Unity-2D Set­tings (Ubuntu 11.04) […]

  31. […] A simple GUI for Unity-2D Settings (Ubuntu 11.04) | Mariano Chavero […]


Leave a comment