Execute wmctrl commands in xinitrc

2

I'm using XMonad configured to accept commands through wmctrl and would like to start up a few applications through xinitrc and move them to a certain workspace.

Those commands work, when I use the through the terminal:

# Launch a terminal with ncmpcpp and move it to workspace 9
urxvt -e ncmpcpp && wmctrl -r ncmpcpp -t 9 

But if I try to put them into my .xinitrc they are not working anymore. The applications start-up, but aren't moved to the correct screen. I suspect this is because the calls execute before xmonad has been executed.

xinitrc:

(urxvt -e ncmpcpp && wmctrl -r ncmpcpp -t 9) &
exec xmonad

I already tried adding a sleep-period, but this did not help either and I would like to get this working reliably:

(urxvt -e ncmpcpp && sleep 5 && wmctrl -r ncmpcpp -t 9) &
exec xmonad

pmr

Posted 2014-01-20T17:32:56.380

Reputation: 131

Answers

2

You need to execute xmonad before launching terminals and trying to move them.

xmonad &
(urxvt -e ncmpcpp && wmctrl -r ncmpcpp -t 9)

user270595

Posted 2014-01-20T17:32:56.380

Reputation:

Isn't the purpose of exec to replace the current process with the process launched by the arguments and how are commands executed after that? – pmr – 2014-01-20T18:43:22.873

That's my bad, I'm to tired to think right now. – None – 2014-01-20T18:52:21.440