mikshaw --> dwm (2006-10-18 16:02:21 -0400):
> My opinion is the pipe loop is not an ideal way to handle dwm status,
> but it seems to be the only thing that works as it is coded. The problem
> seems to be that the "while" command is actually the main X process when
> dwm is run this way, so killing dwm does not end xinitrc. My choice would
> have been to allow dwm to run as the final command in .xinitrc and also
> allow it to read stdin...something like exec dwm < loop command, perhaps?
>
> In any case, my current start script for dwm looks like this:
>
> while pidof dwm &>/dev/null
> do
> date +"[%H:%M] %a %b %d" && sleep 5
> done | /opt/dwm/bin/dwm
>
> It's still not ideal for two reasons:
> 1) i still have to wait up to 5 seconds for X to shut down
> 2) sometimes it results in a broken pipe, presumably if dwm does not
> start immediately (pidof exits non-zero?).
I'm using a script writing status bar information to a fifo from
which dwm reads. This seems to work well for both startx and xdm X
initialisation and doesn't suffer from the problems you describe.
The script (~/.dwm/in.sh) basically contains:
#!/bin/sh -e
[ $# -eq 1 ]; FIFO="$1"
[ -e "$FIFO" ] || mkfifo "$FIFO"
[ -p "$FIFO" ]
exec >"$FIFO" 2>&1
while :; do
# XXX write dwm status bar information
sleep 10
done
exit 1 # NOTREACHED
It creates the fifo if it doesn't exist, redirects stdout and stderr
to it and loops forever, writing status bar information.
My ~/.xinitrc (or ~/.xsession, if using xdm) contains:
WM=dwm
fifo=~/.dwm/in
~/.dwm/in.sh $fifo &
while [ ! -p $fifo ]; do sleep .1; done
exec <$fifo
$WM &
wmpid=$!
wait $wmpid
This starts the status bar information writing script in the background
and waits until the fifo is created. It then redirects stdin from the
fifo (for dwm), starts dwm and waits for it. Thus exiting (or killing)
dwm causes X to shut down.
HTH, Jukka
-- bashian roulette: $ ((RANDOM%6)) || rm -rf ~Received on Wed Oct 18 2006 - 23:25:09 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:32:07 UTC