[xmonad] startup programs

Olivier Schwander oschwand at chadok.info
Sun Aug 30 12:24:23 EDT 2009


Hi,

Le 15 Aug 2009 23:28, Bozelos Dimitris a écrit:
> 1) Sometimes programs are placed in different order than asked in the startup hook, probably because of different startup times. Also sometimes one program might need another to successfully run. So is there a way to have xmonad to wait until one program has fully started before proceeded to the next? In my case something like
> 
> myStartupHook = do
>             spawn "xterm -e '/usr/bin/jackd -R -dalsa -r48000'"
>             a command for " wait until jackd has ran " or " wait 5 seconds " and then
>             spawn "xterm -e 'chuck --loop --srate48000'"

Why do not use a .xsession file in your home ? It would be launched by
your login manager and manage your session as you want.

$ cat ~/.xsession
/usr/bin/jackd -R -dalsa -r48000
# I don't know if the jackd command terminate or if it waits until it has finished to launch, if not:
# sleep 5
chuck --loop --srate48000
exec xmonad

 
> 2) Is there a way to run a terminal and a program from a specified directory? Like if I would do in a terminal : 1) cd "path" 2) emacs - so that emacs starts with "path" as its default directory

Always in your .xsession

(
	cd your/path
	emacs &
)

> 3) With some programs with no graphical interface that print messages to the terminal like jackd as above, when I startup with the above way it's not really the same as if I would call it from a terminal. If it terminates for any reason it dissapears while if I had ran it from a terminal the terminal would stay and I could have seen any error messages. Anybody knows if it can be otherwise?

All the log of command run with .xsession are in ~/.xsession-errors
You can also redirect output like that:
jackd 1>jackd_stdout 2>jackd_stderr
 
> 4) I couldn't really find out how to move a program or terminal to a desktop, can you please make your example more precise? Let's say I want to run 2 instances of emacs and move the first to desktop 1 and the second to desktop 2. How would I do this?

I don't knwow how to set a class or a title with emacs (I'm sure it's
possible, but I don't have time to search right now).

With xterm, you can launch one xterm with the -title option

xterm -title desktop1 -e "..."
xterm -title desktop2 -e "..."

and match in your xmonad.hs:

myManageHook = manageDocks <+> composeAll
    , title     =? "desktop1" --> doF (W.shift "1")
	, title     =? "desktop2" --> doF (W.shift "2")
    ]

You can also set the class with -class (xterm -class MyClass ...) and
match on: className =? "MyClass" --> doF (W.shift "2")
When possible, you should try to use the title attribute.

Good luck,

Olivier



More information about the xmonad mailing list