Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have recently started to try XMonad and I'm loving it, so far I've managed to set-up xmobar with it.

However, I'm stuck on how to autostart applications, so far I've got both an .xinitrc contains

#!/bin/bash
xrdb -merge .Xresources
if [ -x /usr/bin/nm-applet ] ; then
   nm-applet
fi

if [ -x /usr/bin/gnome-power-manager ] ; then
sleep 3 
gnome-power-manager
fi


exec xmonad

That is it, what am I doing wrong? Thanks for any help!

share|improve this question
    
I can see no obvious problem with your .xinitrc. What would you like it to do? What do you get instead? –  Riccardo Murri Oct 16 '11 at 18:16
add comment

1 Answer

You need to add an ampersand after anything that needs to run in the background, nm-applet and gnome-power-manager in your case. Otherwise it'll just wait there for those to exit before it does anything else.

So your .xinitrc should look like this:

#!/bin/bash
xrdb -merge .Xresources
if [ -x /usr/bin/nm-applet ] ; then
   nm-applet &
fi

if [ -x /usr/bin/gnome-power-manager ] ; then
sleep 3 
gnome-power-manager &
fi


exec xmonad

Alternatively, you could run xmonad as the window manager inside a Gnome session, and then whatever is set in gnome-session-preferences will autostart. For instructions on how to do that, go here: http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Gnome

share|improve this answer
    
As a side note, you probably also want to use ck-launch-session on the exec line for xmonad to avoid issue with applications that rely on ConsoleKit. So that line would look like this instead: exec ck-launch-session xmonad. It doesn't have anything to do with your question, so I didn't include it in the actual answer though. –  Raugturi Feb 10 '12 at 14:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.