[dwm] Displaying status info

From: Jukka Salmi <j+dwm_AT_2006.salmi.ch>
Date: Fri, 21 Jul 2006 11:17:54 +0200

Hi,

just a hint: if you follow the example from the README to display some
info in the bar, you'll have to wait for up to 5 seconds - i.e. for
as long as your script sleep(1)s - after quitting dwm until the X
server shuts down. And if your script traps SIGPIPE you'll wait forever
;-)

To avoid this delay, I'm using the following script:

#!/bin/sh -e

[ $# -eq 1 ]; FIFO="$1"
[ -e "$FIFO" ] || mkfifo "$FIFO"
[ -p "$FIFO" ]
exec >"$FIFO" 2>&1

while :; do
        printf '%s | %s\n' \
            "$(uptime | sed 's/^.*load averages: /load avg: /')" \
            "$(date '+%a, %b %d, %H:%M')"
        sleep 10
done

exit 1 # NOTREACHED

I start dwm from ~/.xinitrc (~/.dwm/in.sh is the script above):

fifo=~/.dwm/in
~/.dwm/in.sh $fifo &
exec <$fifo
dwm &
wmpid=$!
[...]
wait $wmpid

Cheers, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
Received on Fri Jul 21 2006 - 11:17:56 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:29:48 UTC