Small Configuration Tool for Ubuntu Unity-2D 12.04 LTS Precise Pangolin (Updated Apr 11th 2012)

An update to the small desktop tool for Unity 2D to work with Ubuntu 12.04 LTS Precise Pangolin.

Download: For 12.04 Precise Pangolin only

QuickLists

Features:

-> Dash and Icon right click Shortcuts (QuickLists) for launcher settings and compositing manager’s extra effects, which brings window edge shadows and “alt-tab thumbnail previews” very handy for multi-tasking.

Unity 2D Desktop Tool

-> Updated Gtk3 GUI: Few available options to tweak Unity 2D not included in ‘System Settings’ for Launcher and Dash, Applications Lenses and a checkbox to enable OpenGL for Graphics Rendering as long as your system has a supported graphics card. If so, you might not be able to see any differences in your desktop regarding its visual components but just an overall graphics performance improvement.
Note: The Compositing Manager checkbox available in previous versions of the GUI has been removed. The switcher shortcut in the dash or quicklist in the icon handles this features and brings a pop up message dialog which helps to refresh the desktop so window shadows are instantly enabled.


Small Desktop Settings Tool for Ubuntu Unity-2D 11.10 (Updated Apr 3rd 2012)

This is an update to the small tool I made for Unity 2D to save time modifying its settings from the terminal or dconf-editor.

An updated Version for 12.04 LTS can be found in this post

Download: (Requires an up to date Ubuntu 11.10 System)

Features:

-> Icon right click Shortcuts (QuickLists) for launcher settings and compositing manager, which brings window edge shadows and alt-tab thumbnail previews, very handy for multi-tasking.

The same shortcuts can be found by searching for them in the dash.

-> An updated (From PyGtk) Gtk+3 GUI with the two available Unity-2D preferences for dash and launcher and a few extras.

Notes: Window Shadows will not show until you click everywhere in your desktop to refresh the compositing effect once enabled via the checkbox icon in the GUI. (The Quicklist and Dash shortcuts will launch a message dialog that will refresh the compositing effects automatically.)
The ‘Always Show’ option for the launcher will not work while the launcher is hidden (A native bug in Unity-2D caused by the ‘use-strut’ gsettings key), you can use “Super” or “Alt+F2” keyboard shortcuts to force the launcher to show.


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()