Jaunty notifications on Arch Linux

March 27, 2009

The upcoming Ubuntu (codenamed Jaunty Jackalope) 9.04 has a new notification system. Since it’s so beautiful, you may wonder if it’s possible to get that stuff onto your Arch box. Here’s how:

  • Install notify-osd-bzr from Hugo Doria’s repository. You can enable the repository by putting these lines at the top of your pacman.conf:
    [archlinuxbr]
    Server = http://repo.archlinux-br.org/i686/
    

    For those of you on 64-bit you can install the notify-osd-bzr package from AUR.

  • notify-osd shows dialogs for notifications with actions which looks quite ugly. So quite a few applications have to be patched to remove actions for notifications wherever possible. Patched versions of some applications can be found in AUR. Some of these are also available from the archlinuxbr repository.
  • Install human-icon-theme from AUR and use it to get the icons in gnome-power-manager and networkmanager notifications (unfortunately, these icons not yet standardised and only come with the human theme).
  • Enjoy the new notifications! Note that you must logout and log back in before the new notifications can be active.

For more information on the new notification system in Jaunty you can read up the specification at: http://wiki.ubuntu.com/NotifyOSD.


making keyboard shortcuts in linux as uniform as the mac

March 11, 2009

Keyboard shortcuts in GNU/Linux are not as uniform as in, say the Macintosh. Having uniform keyboard shortcuts for common tasks which do not conflict is an integral part of a good user interface. While the trinity of cut-copy-paste shortcuts have been almost universally implemented, there are quite a few other shortcuts that should be common (closing a window, quitting an application, opening preferences). Yesterday, I tried to get some uniformity in keyboard shortcuts in my GNOME desktop.

The first thing to do is to allow changing the accelerators (keyboard shortcuts) in the GNOME configuration. This can be done by issuing the following command at a Terminal:
gconftool-2 -t bool -s /desktop/gnome/interface/can_change_accels true

Then I mapped Ctrl to the Alt key (which is just in the place where the Command key is on the Mac) and the Alt key to the Windows key. This can be done in GNOME by going to System »Preferences » Keyboard » Layout » Layout Options… and changing Alt/Win key behaviour. This is not really necessary, but mapping the Ctrl key to the Alt key made it a lot easier for my fingers.

Now to change the keyboard shortcut corresponding to any menu in GNOME, you simply have to select the menu item and press the shortcut you wish to have associated with the menu item. However, this does not work for all GTK programs. The programs for which I could change the shortcuts using this way included Nautilus, Rhythmbox, Pidgin, Totem, Terminal, Gedit, Image Viewer. For example, I changed all the preferences shortcuts to Control+comma. Keep in mind that if the shortcut you assign is already assigned to some other function, then the shortcut will be reassigned to the menu item you’ve selected and the previous functionality corresponding to the shortcut will not have any shortcut assigned to it.

Some other shortcuts that I changed in Nautilus are: Control+I for Properties (this is consistent with the same shortcut for Firefox’s Page Info and the Mac OS X Finder), Control+D for Duplicate, Control+Shift+Delete for Empty Trash and Control+Shift+C for Computer.

Of course, we also have to change the shortcuts for the window manager we’re using. Since I’m using Compiz, I used ccsm (Arch: ccsm, Ubuntu/Debian: compizconfig-settings-manager package), to change the shortcut for closing an window to Control+W (in General Options » Key bindings). Also I changed the default shortcut for Run Command… from Alt+F2 to Control+space in Gnome Compatibility. Since I’d gotten used to pressing Alt+Tab for switching windows, and now Alt had become the Win key, I also had to change the shortcut for switching windows to Control+tab (in Application Switcher).

Firefox: I used the Keyconfig extension to change the keyboard shortcuts in Firefox. I changed the Preferences, Back and Forward shortcuts, as well as the shortcuts for switching to tabs 1 to 9. Since Control+W was now used to close the window, I assigned Control+Shift+W for closing the tab (the same applied for other applications which use tabs a lot, like Gedit).

VLC. I tried to change the shortcut for preferences in VLC to Control+comma but I could not find any way of doing so. There is an option for changing the hotkeys, but that does not include Preferences. So I’ve to stick with the default for the time being. GIMP had a nice shortcut editor, using which I could easily change the shortcut for Preferences.

After all this, you might want to turn off the ability to change accelerators in GNOME by issuing this at the terminal: gconftool-2 -t bool -s /desktop/gnome/interface/can_change_accels false

Update (18 Oct 2009): Registered the uniform-keyboard-shortcuts blueprint in Launchpad.


Setting up a planet

December 28, 2008

So, how does one set up a planet?

In case anyone thinks I’m nuts, I’m talking of setting up a planet like this (or this). A planet here is just a collection of blogs, and I’ll talk about how to set up one using the software called planet venus. To get started just download the tarball. Extract it into a directory of your choice (using tar zxvf venus.tgz), and you’ll see the directory structure as on the website. The documentation is quite detailed, but if you want a planet quickly, you won’t have to read most of it.

Here’s what I did: I made a directory and copied the file themes/classic_fancy/config.ini to this directory (you might prefer some other theme, in this case choose the appropriate config.ini). Edit the file accordingly; mostly you’d need to change the [planet] section. The other important settings to check are cache_directory and output_dir. It’s better to set the full path here and in the other places which require a directory (template_files) — this helps when running the cronjob later. All the generated files will be in output_dir. You can find the index.html.tmpl (index.html template) in the theme directory and the other templates (Atom, RSS feeds) in the themes/common directory.

Remember to put planet.css and other relevant images in the proper places, otherwise people will see an ugly page!

Now add the feeds which you would like to have in the planet in the following format:

[http://blah.wordpress.com/feed/] # This should be the feed url
name = My Name

You’re done! Now switch to the directory where you untarred the planet venus code and run python planet.py /path/to/config.ini. This will download the feeds, store them in the cache and generate the index.html, Atom and RSS feeds.

Finally set this thing to run as a cronjob (using crontab -e); the snippet below will make planet.py run hourly:

0 * * * * /usr/bin/python /full/path/to/planet.py /full/path/to/config.py

Science Conclave at Allahabad

December 25, 2008

Merry Christmas to the blogosphere!

Christmas evenings are a nice time to talk about lots of things, so I’ll talk about the trip to the Science Conclave at IIIT Allahabad which I attended along with my friends (eight of them, to be precise) and a scientist from our institute. This science conclave was attended by quite a few nobel laureates and other expert scientists.

Five of our friends had reached IIIT Allahabad in the morning of the 14th of December (the conclave duration was from 15th to 21st December). We reached via a different train at nearly midday; it was quite nice that we got a room on the same floor as the other group. The conclave was due to begin the next day, so there was actually nothing that I could think of doing, and that’s what happened. We were staying at the boys’ hostels on the ground floor (almost literally; what separated us from the floor was a blanket). There were nice blankets on top also to keep out the cold (of which there was a lot).

The next day was the first day of the conclave; as usual I got up a bit late; breakfast was done in a hurry and we’re off to the lectures. The morning lectures were held at a pandal on the campus. Since I don’t remember the order of the lectures, I shall not now be going into the details of them (not too much, anyway any details become foggy after a few days). After the lecture there was a felicitation ceremony and speech by the director of IIIT-A. By this time, I was feeling hungry (always happens after lectures) and soon my stomach was satisfied (at least I thought so, I did not know then what was to happen a week later!). The second day passed like the first day, with one exception.

One evening, someone suggested that we should play the game of “mafia”. I wondered what that was and why others seemed so excited about it. I’ll leave the explanation of the game to wikipedia; what was amazing was how I changed from a bored bystander to a fan of the game (apparently, this always happens in this game). We had lots of rounds of Mafia, and I managed to guess people correctly quite a few times, though as the night wore on, my guesses wore out :) I slept at around four o’ clock and woke up with a nice attack of rhinovirus. Oh well.

The interaction sessions were held at the computer centre; interaction sessions were divided according to discipline; though I didn’t much like it, for in my viewpoint I consider science to be indivisible, it would be infeasible for all of the almost over thousand students to interact with the Nobel Laureates — that would only result in chaos of the non-interesting kind. The questions ranged from nice, profound to downright silly, so one could almost plot a Gaussian there. The nobel laureates were very helpful and listened to all the questions carefully. We had interaction sessions with Prof. Claude Cohen-Tannoudji, Prof. Jerome Friedman, Prof. Martin Perl and Prof. Harry Kroto. I slipped into a Mathematics interaction session once where I could interact with Prof. A A Slavnov of Steklov Mathematical Institute.

We heard nice lectures from all the nobel laureates; most of them were on high energy physics and the Large Hadron Collider and the interesting prospects the LHC opened up for a new generation of research. Arguably the most inspiring one was however, Sir Harry Kroto’s. I never knew that I would like a chemistry lecture so much! The presentation started with a very loud sound (to wake us up) and continued in a fashion which was like a well arranged salad: flashes of humour, beautiful animations, pictures from the past and visually striking, simple images which make us understand in an instant what his research is about, and on why he loves bucky balls aka fullerenes. I’ll never feel the same way about chemistry, or at least fullerenes again. He gave two lectures; both were different but in some way carried the same spirit.

In the evenings were the cultural programmes. I didn’t expect a cultural programme of this magnitude at a science conclave, but then there it was. Many eminent people performed at the cultural programme, including Hema Malini, Peenaz Masani, Anoop Jalota, Dr. Shobha Naidu and Bhupinder & Mitali Singh. There’s no need to say how they were: they were all astoundingly brilliant and beautiful.

Thus as you see, a lot of things happened at this conclave. We had lots of fun, listened to interesting lectures and talked with interesting people. Space and time, restricted they are; to tell everything of what happened at the conclave would take days and more words than I’ve the patience to type. However, it was a memorable experience and I thank all those who made it happen.

Oh by the way, as to what happened a week later: I had a nice stomach upset.

Update: added links.


date hack

November 18, 2008

The computers at our institute don’t have NTP installed, and the time
is rarely synchronized. The date on the computer I am writing this post
on is about half an hour behind. So here’s how you can get the correct
date from the terminal using wget, sed and the good ol’ date:


#!/bin/sh
# Prints the date.

x="$(wget -q -O - http://tycho.usno.navy.mil/cgi-bin/timer.pl | grep UTC | cut -c 5- | sed s/\,//g)"
date -d "${x}"

Put this file somewhere in your $PATH, make it executable and run it. It’ll print the
date in the local timezone. Here’s how it works:

  1. It gets the date from http://tycho.usno.navy.mil/cgi-bin/timer.pl and dumps it on the
    terminal.
  2. It gets the first line in UTC using grep
  3. It cuts out the
    .
  4. and removes the comma which causes date to choke
  5. Finally date -d converts the date into the local timezone and displays it.

I’ve this script running with watch -n 5 to give the date every five seconds in the terminal.