Ordering the GNOME systray

I love exactly this sequence of icons in my GNOME systray

See those icons in the systray? While plenty of people do not care in what order those icons are placed in their systray I do. And this topic has been on my mind for some time since the realization of how great control over the system and its components can be in a Linux environment dawned on me.

My first try was with KDE 3.5.x and it was a no go. I came up with this idea of running a simple bash script, essentially an ordered sequence of applications I always need to run upon the new login session, but it wouldn’t work as expected. For some reason sleep command was ignored and to put applications in a specific order it was basically impossible. I think it could be due to poor idea implementation but since I moved away from KDE and use GNOME these days it doesn’t matter anymore.

Here I am working in GNOME and after having to run 7-8 applications each time I start up the laptop or login anew, which in itself takes up about 5-7 minutes and requires human attendance, this quickly became a real pain. 2011, advanced computing technology is abundant, automation is thriving as never before and here I am spending about an hour a week or so doing what, running 7-8 applications – a pointless, dumb activity.

So, I decided to try it again and this time I got it done right. GNOME simply follows the logic that I use when think about how GNOME could handle autostart applications, such as a bash script, which eventually enables me to run:

  1. pidgin
  2. stardict
  3. zim
  4. transmission
  5. banshee
  6. miro
  7. evolution

in exactly that sequence automatically.

Here’s how it’s done.  I created a bash script ~/scripts/autostart.sh, gave it execution bit by chmod +x. Its contents is outrageously simple:

stardict &
sleep 25
zim &
sleep 1
transmission-gtk &
sleep 3
banshee-1 –redirect-log –play-enqueued %U &
sleep 5
miro &
evolution &

sleep parameter is needed to introduce pauses in between the execution of applications (so that they’re not run and placed in systray haphazardly) and tuned to account for time required to start an application. In my case stardict takes quite a bit of time to start due to a big number of dictionaries needed to be loaded so it’s 25 seconds. It’ll all depend on your very own set of applications and how fast they load. Conduct an observation session and note down the results, then use them as parameters for your script.

When your script is ready go to System->Preferences->Startup Applications and add new program, your script.

Startup Applications

Adding new program, my autostart script

Log out and log in to see how it works. I had to log out and in a few times to get the timing right and now I have GNOME running these 7 applications for me, in exact sequence as I defined and placing their icons in systray the way I want them to be placed.

Which is awesome.