mirror of https://github.com/0intro/wmii
24 lines
539 B
Bash
24 lines
539 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
|
|
xwrite /bar/new/colors $WMII_NORMCOLORS
|
|
n=`wmiir read /bar | awk '/[0-9]+$/ {if($NF>max) max=$NF} END {print max}'`
|
|
trap "wmiir remove /bar/$n 2>/dev/null; exit" 15
|
|
|
|
while true
|
|
do
|
|
xwrite /bar/$n/data `date` `uptime | sed 's/.*://; s/,//g'` || exit
|
|
sleep 1
|
|
done
|