Re: [xmonad] startup programs

Hello everyone, thanks for your replies and sorry for the late reply from my part, I didn't have internet access for looong time. Thanks a lot Olivier, that's the closest to what I want to do. I have some questions: 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'" 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 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? 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? Thanks, Dimitris
You can launch each terminal you want to put on the desktop FooBar with the command "xterm -name gotoFooBar" and add the following manageDocks to your xmonad.hs:
myManageHook = manageDocks <+> composeAll [ title =? "gotoFooBar" --> doF (W.shift "FooBar") ]
Moreover, you can know the class and the name of an X windows with the command xprop.
Cheers,
Olivier
Hello everyone, After making the usual statement that I'm completely new to xmonad and I have no clue about haskell, I have loved xmonad and I have a question to find out if I can make more out of it: I'm using fedora linux with xmonad and i'm preparing for a music performance. I need at the concert to be able to startup my laptop and if possible to have everything up and running, without having to switch between desktops and run terminals & programs. This means that I don't only want to run some programs at startup (which could be done in the usual way for linux with a startup script - although I don't really know much about it) but I want the programs to be ran from terminals and be placed in the desktops in the way I would do manually after launching xmonad. Is this possible with xmonad? Any simple tutorials available on this? Thanks, Dimitris
___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr

2009/8/15 Bozelos Dimitris
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'"
Back when I was using ratpoison & stumpwm, the advice was to use the xtoolwait program which will start a program and wait for it to map an X window before exiting. I'd guess you'd do something like 'spawn "xtoolwait jacked && xterm"'. (Jacked is a GUI program? If it isn't, regular shell scripting should be fine, shouldn't it?) -- gwern

On Sat, Aug 15, 2009 at 11:28:31PM +0000, Bozelos Dimitris wrote:
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
spawn "cd foo; some_application" should work. If it doesn't, runProcess from System.Process lets you specify a working directory: http://hackage.haskell.org/packages/archive/process/1.0.1.1/doc/html/System-...
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?
If you are using the darcs version of xmonad, you can use XMonad.Actions.SpawnOn. Another way would be to have the application set a custom resource string(E.g. urxvt's -name option) or such which you could use in a manage hook to distinguish between the instances, but not every application lets you do that.

Bozelos Dimitris
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'"
spawn "sleep 5; xterm -e 'check --loop --srate48000'" or something more elaborate, like spawn "while ! jack_lsp; do sleep 1; done; xterm ..."
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?
Try spawn "... || read" for example. Your shell is at your command. -- Feri.

Hi everybody, I am using avoidStruts from XMonad.Hooks.ManageDocks to toggle between the dock gaps, so I have something like myLayout = avoidStruts $ ... in my xmonad.hs. Now, I only have the tiniest panel ever which only consists of a clock and the icon of the nm-applet. I would prefer if xmonad would cover up the docks by default, and only when I'd like to check the time or like to have a look at the Internet connection, to toggle the gap to appear. Is there any neat and straight forward way to do so? Thanks so much in advance! Cheers, Thomas

On Mon, Sep 21, 2009 at 7:15 PM, Thomas Friedrich
Hi everybody,
I am using avoidStruts from XMonad.Hooks.ManageDocks to toggle between the dock gaps, so I have something like
myLayout = avoidStruts $ ...
in my xmonad.hs. Now, I only have the tiniest panel ever which only consists of a clock and the icon of the nm-applet. I would prefer if xmonad would cover up the docks by default, and only when I'd like to check the time or like to have a look at the Internet connection, to toggle the gap to appear.
Is there any neat and straight forward way to do so?
Thanks so much in advance!
Cheers, Thomas
Half-relevant issue: http://code.google.com/p/xmonad/issues/detail?id=168 -- gwern

I think you could use avoidStrutsOn with empty brackets. Like this:
myLayout = avoidStrutsOn [] $ ...
Then you docks will start hidden by default and ToggleStruts will show them.
Regards,
Henrique G. Abreu
On Mon, Sep 21, 2009 at 20:15, Thomas Friedrich
Hi everybody,
I am using avoidStruts from XMonad.Hooks.ManageDocks to toggle between the dock gaps, so I have something like
myLayout = avoidStruts $ ...
in my xmonad.hs. Now, I only have the tiniest panel ever which only consists of a clock and the icon of the nm-applet. I would prefer if xmonad would cover up the docks by default, and only when I'd like to check the time or like to have a look at the Internet connection, to toggle the gap to appear.
Is there any neat and straight forward way to do so?
Thanks so much in advance!
Cheers, Thomas
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Henrique G. Abreu wrote:
I think you could use avoidStrutsOn with empty brackets. Like this: myLayout = avoidStrutsOn [] $ ... Then you docks will start hidden by default and ToggleStruts will show them.
Regards, Henrique G. Abreu
On Mon, Sep 21, 2009 at 20:15, Thomas Friedrich
wrote: Hi everybody,
I am using avoidStruts from XMonad.Hooks.ManageDocks to toggle between the dock gaps, so I have something like
myLayout = avoidStruts $ ...
in my xmonad.hs. Now, I only have the tiniest panel ever which only consists of a clock and the icon of the nm-applet. I would prefer if xmonad would cover up the docks by default, and only when I'd like to check the time or like to have a look at the Internet connection, to toggle the gap to appear.
Is there any neat and straight forward way to do so?
Thanks so much in advance!
Cheers, Thomas
Well that was easy. Really could have thought about this. Thanks so much!! Thomas

Henrique G. Abreu wrote:
I think you could use avoidStrutsOn with empty brackets. Like this: myLayout = avoidStrutsOn [] $ ... Then you docks will start hidden by default and ToggleStruts will show them.
Regards, Henrique G. Abreu
On Mon, Sep 21, 2009 at 20:15, Thomas Friedrich
wrote: Hi everybody,
I am using avoidStruts from XMonad.Hooks.ManageDocks to toggle between the dock gaps, so I have something like
myLayout = avoidStruts $ ...
in my xmonad.hs. Now, I only have the tiniest panel ever which only consists of a clock and the icon of the nm-applet. I would prefer if xmonad would cover up the docks by default, and only when I'd like to check the time or like to have a look at the Internet connection, to toggle the gap to appear.
Is there any neat and straight forward way to do so?
Thanks so much in advance!
Cheers, Thomas
Well that was easy. Really could have thought about this. Thanks so much!! Thomas

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
participants (7)
-
Bozelos Dimitris
-
Daniel Schoepe
-
Ferenc Wagner
-
Gwern Branwen
-
Henrique G. Abreu
-
Olivier Schwander
-
Thomas Friedrich