15 February 2010

Karmic, openbox, and messed up desktop numbers (SOLVED)

I think it started after I upgraded to Karmic. When logging into an openbox session, the number of desktops I was getting was equal to one ... no matter what I set the number to during the previous session. Herein I describe a fix.

The script that gets called when GDM starts up an openbox session is /usr/bin/openbox-session. It just so happens that before I upgraded to Karmic, I had created a new script in /usr/local/bin/skinnydebbie-session that was a copy of the Jaunty version of /usr/bin/openbox-session with a few changes in the config files called. The interesting thing was that after the Karmic upgrade I did not have the wrong-number-of-desktops problem when starting from /usr/local/bin/skinnydebbie-session.; it only manifested itself when starting from /usr/bin/openbox-session. A quick comparison of the two files revealed a fix. At the top of my /usr/local/bin/skinnydebbie-session is the following snippet of code which I am sure was inherited from the Jaunty version of /usr/bin/openbox-session and was probably left off the Karmic version:

# Clean up after GDM
xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
      -remove _NET_DESKTOP_NAMES \
      -remove _NET_CURRENT_DESKTOP 2> /dev/null

I added this snippet to my ~/.config/openbox/autostart.sh and voila! I get the right number of desktops. I am pretty sure it would work if I added it to /usr/bin/openbox-session instead.

This should probably be a bug report, but I'm feeling a bit too lazy now to do it.