Least Action

Nontrivializing triviality..and vice versa.

Customizing GNOME3

leave a comment »

The purpose of this post is to help you configure GNOME3 and make it look more ‘zazzy’ than it is. Most of these tweaks have been inspired by the archlinux forums and FP Murphy’s blog, which is the source for learning how to customize GNOME3. I thought it would be a good idea to put it all in one place, mostly for my own reference. Note that I have tested all this on Natty 64-bit. I also thank Charles Bowman for his help and inputs over the past few weeks.

The gnome-tweak-tool does not let you change much, unless you add extensions to the gnome-shell, which really open up the world for a tweaker. I won’t go into the anatomy of an extension, as FP Murphy does an excellent job in explaining it. I will just assume that you know enough about it. If you don’t, you will still be able to get all these tweaks to work, but you won’t understand how they work, and believe me, it won’t be quite as much fun!

Extensions are installed in

~/.local/share/gnome-shell/extensions

but if they are to be made accessible to all users, then they should go in

/usr/share/gnome-shell/extensions

You can pick either configuration. I will work with ~/.local/share/gnome-shell/extensions from now on, because I am running all this on a single user system. Remember that ~/ is a mnemonic for your home directory. Instead of using the long /home/user_id/, I will just refer to it as ~/ from now on.

One way to play with extensions is to get hold of Charles Bowman’s gnatty pack. It is available from http://cid-32ec6e89f4aa803b.office.live.com/self.aspx/Linux/gNatty%20Pack.tar.gz?wa=wsignin1.0&sa=92561471. Since several extensions seem to be around, with different names, I will just go over the ones I have gotten to work one by one.

Some words of caution before we begin the expedition: some extensions are not compatible with others, and if you install two mutually incompatible extensions, it is possible that the Gnome Shell will not load, and you will be asked to log out. This can be fixed by moving the bad extension out of ~/.local/share/gnome-shell/extensions or simply renaming it:

mv ~/.local/share/gnome-shell/extensions/bad_extension ~/.local/share/gnome-shell/extensions/bad_extension.old

It turns out that this works because each extension has a file inside called ‘metadata.json’ with a field called a unique id (uuid) which must match the name of the directory. Changing the directory name using the mv command above will create a disparity between uuid and the directory name, which will prevent the extension from loading.

If you install a whole bunch of extensions together, it will obviously be hard to debug any problem, because you don’t know which extension is the culprit. So it is best to install one extension at a time, and restart the GNOME Shell. This can be achieved either by logging out and logging back in, or pressing Alt + F2 and typing r and pressing Enter. This restarts the shell. Sometimes though, restarting the shell this way results in spurious errors which may suggest that the extension is messing up something. So, I do prefer to double-check by logging out and logging back in again, though this is relatively cumbersome as it will close all open applications.

With this preliminary knowledge, we are ready to embark on the first step. The basic algorithm is to create two files, extension.js and metadata.json, for every extension. Each extension resides in its unique directory (folder) in ~/.local/share/gnome-shell/extensions/.

Extension #1: Move Clock

The default position of the clock in Gnome is in the center of the top bar. This is irritating for those of us who are used to the old Gnome2 interface where the clock would appear on the right. This is easily fixed.

cd ~/.local/share/gnome-shell/extensions
mkdir Move_Clock@rmy.pobox.com
cd Move_Clock@rmy.pobox.com

Now create two files using your favorite editor, extension.js and metadata.json with the following contents:

extension.js

const St = imports.gi.St;

const Main = imports.ui.main;

function main() {
    Main.panel._centerBox.remove_actor(Main.panel._dateMenu.actor);
    let children = Main.panel._rightBox.get_children();
    Main.panel._rightBox.insert_actor(Main.panel._dateMenu.actor, children.length-1);

    Main._nWorkspacesChanged = function() {};
    Main._queueCheckWorkspaces = function() {};
    Main._checkWorkspaces = function() {};
}

metadata.json

{
"shell-version": ["3.0"],
"uuid": "Move_Clock@rmy.pobox.com",
"name": "Move Clock",
"description": "Move clock to left of status menu button"
}

Restart the shell. The clock should now be visible on the right hand side of the top bar. We can customize it further, to display the time and date in a detailed fashion.

First start gnome-tweak-tool, and click on Shell. You should see a window which looks like this:

gnome-tweak-tool shell tab

You can toggle the ON/OFF switches for ‘Show date in clock’ and ‘Show week date in the calendar’.

Some more date and time settings can be changed using gnome-control-center. Type

gnome-control-center

in a terminal window and click on Date and Time. Note that this tool does not allow you to show a seconds counter in the clock. If you wish to display seconds, fire up a gnome-terminal window and type

gsettings set org.gnome.shell.clock show-seconds true

This will display a live ticking seconds counter.

Note that the status of presently installed gnome-shell-extensions can be determined from and changed within gnome-tweak-tool. Every time you install an extension manually and restart the shell, by default it is enabled.

Under Construction

Advertisements

Written by Vivek

June 1, 2011 at 15:09

Posted in Linux, Programming

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: