
I tried this, but the biggest problem (for me) was to be able to distinguish between different instances of xmobar running. I solved it with (in the startup shell script):
xmobardown=`ps ax |grep xmobar|grep -v up|awk '{print $1}'` for proc in ${xmobardown} do kill -9 ${proc} done xmobar ~/.xmobardownrc &
I am sure there is a more elegant way to do it, maybe using pidof (it didn't work for me tho) but this works, more or less. You say you use 4 instances of xmobar? Can I put xmobar also in "vertical"? That would be nice ;) My solution to the trayer problem involved searching through /proc/ for
Marco Guidetti wrote: the command name and spawning only if it doesn't find anything. I could post it here when I get home if you want, but it doesn't work for several instances of the same program. Also, I discovered a module called SpawnOnce in darcs XMonadContrib (after implementing my own), which might or might not work for you.