[xmonad] darcs patch: instruct users to use exec to start xmonad from .xinitrc

Jesús Guerrero i92guboj at terra.es
Fri Jun 27 09:26:44 EDT 2008

On Fri, 27 Jun 2008 06:12:26 -0700
Andrew Sackville-West <andrew at swclan.homelinux.org> wrote:

> On Thu, Jun 26, 2008 at 05:43:26AM -0500, Spencer Janssen wrote:
> > On Thu, Jun 26, 2008 at 04:21:37AM -0500, brianchina60221 at gmail.com wrote:
> > > Thu Jun 26 04:18:00 CDT 2008  brian at lorf.org
> > >   * instruct users to use exec to start xmonad from .xinitrc
> > 
> > It is correct as written.  xmonad does not clean up after child processes
> > started before it and as such should not be 'exec'ed.
> Hi, I thought the purpose (or one of...) was to replace the .xinitrc
> "process" with the xmonad process. Then you can put additional
> commands into .xinitrc *after* the exec to provide some kind of
> functionality in the event xmonad fails to start. A la:
> # do some setup stuff
> exec xmonad
> x-terminal-emulator
> thus giving either xmonad, or if it fails (never!) an xterm to at
> least show that X is working. I am happy to be educated otherwise ;)

That would start xmonad AND (not OR) x-terminal-emulator.

.xinitrc is a bash script. And shells already offer mechanisms to do that. I
don't think that caring about processes and such is a work for a wm.

If you want to use exec, you can do as I do (sample from my xinitrc):

exec xmonad > "${HOME}/logs/xmonad.log" 2>&1 &
exec xmobar &
#exec xfce4-panel &
#exec kicker &
exec conky -c ~/.conkyrc-xmonad | xmobar &
exec urxvtd &
sleep 2
urxvtc -tr -tint grey -fade 50 -fadecolor grey -sh 30 -name server -title server -e ssh root at server &
urxvtc -tr -tint grey -fade 50 -fadecolor grey -sh 30 -name logs -title logs -e mtail -f ~/logs/xmonad.log /var/log/messages
urxvtc -tr -tint grey -fade 50 -fadecolor grey -sh 30 -name htop -title htop -e htop
urxvtc -tr -tint grey -fade 50 -fadecolor grey -sh 30 -name main_term -e screen -D -RR &
exec firefox &
exec sylpheed &
wait $wm_pid
kill -TERM $urxvtd_pid

Use $! to pick the pid of the last process you launched and wait to wait for that
process to end. That way, you can use exec.

But, anyway, if all you want is to start xmonad OR any other thing, you can use
shell builtins as well, it's as simple as to do:

    command1 || command2

The logical OR (||) will launch the second command if the first has a non-zero
exit status (failed).

Jesús Guerrero <i92guboj at terra.es>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080627/fe763632/attachment.bin

More information about the xmonad mailing list