wmii/rc/status

23 lines
485 B
Bash

#!/bin/sh
# periodically print date and load average to the bar
pidfile=/tmp/ns.$USER.$DISPLAY/statuspid
xwrite() {
file="$1"; shift
echo -n "$@" | wmiir write "$file"
}
# race condition alert
test -f $pidfile && kill `cat $pidfile` 2>/dev/null
echo $$ >$pidfile
sleep 1
wmiir create /bar/status
xwrite /bar/status/colors $WMII_NORMCOLORS
trap "wmiir remove /bar/status 2>/dev/null; exit" 15
while xwrite /bar/status/data `date` `uptime | sed 's/.*://; s/,//g'`
do
sleep 1
done