Monday, July 11, 2011

Adding Startup Applications for GDM Window Managers

I ran into a bit of an annoyance today while trying to figure out how to execute custom commands when launching Xmonad, a tiling window manager for Linux. Though Xmonad's documentation promises the execution of commands in .xsession and .Xinitrc, that doesn't seem to be the case on Fedora 14 running Xmonad in a GDM session.

After a bit of tinkering around, I've finally found a solution. GDM's WM selections are defined by files in /usr/share/xsessions. On my system, it looks like this:

[zach@zach-desktop ~]$ ls /usr/share/xsessions/
gnome.desktop xmonad.desktop

The xmonad.desktop file is short and intuitive:

[Desktop Entry]
Encoding=UTF-8
Name=xmonad
Comment=Tiling window manager
Exec=xmonad-start
Terminal=False
TryExec=xmonad-start
[Window Manager]
SessionManaged=true
# vi: encoding=utf-8

You can see that the file defines a couple of environment variables and then executes xmonad-start with the Exec directive.

We could probably add our custom directives to this file, but that isn't very clean, and you probably don't want to cart around xmonad.desktop and overwrite it on new installations. Instead, let's find out where xmonad-start resides:

[zach@zach-desktop ~]$ whereis xmonad-start
xmonad-start: /usr/bin/xmonad-start

The default xmonad-start file is just a simple shell script:

#!/bin/sh
# display the manpage if there is no user configuration
if [ ! -d ~/.xmonad ]; then
xterm -e man xmonad &
fi
exec xmonad

At this point, it's as simple as adding a few new lines:

#!/bin/sh
# display the manpage if there is no user configuration
if [ ! -d ~/.xmonad ]; then
xterm -e man xmonad &
fi
if [ -e ~/.xmonadrc ]; then
. ~/.xmonadrc
fi
exec xmonad

Now you can create a file in your home directory called .xmonadrc- it will be executed every time a new Xmonad session is created.

This will work for other GDM window managers as well; just follow the same steps to find where the startup script is located.

Monday, June 13, 2011

New Job Week!

If you know me or have been following this blog, you'll know that early last year I took a few minutes to set up a service that utilizes Twitterfeed to post new job listings from Craigslist. A few months ago, on a whim, I opened the account to the public and changed the name to @CbusITJobs; the service had been very useful to me and I hoped to help others with their job search.

The response has been great. The account now has over 260 followers, and I've decided it's time to give a little boost to individuals in great need of a new career. For this week, starting today, I'm accepting resumés and a brief description of your current job situation at cbusitjobs@gmail.com. I'll be tweeting the resumés of two candidates per day, starting today and ending Friday. Feel free to add any pertinent information that you think may impress potential employers, such as a personal website, Github account, etc.

Good luck with your job search; it's a tough market, but as long as you keep exploring every vector, things have a tendency to work out for the better.