File: status

package info (click to toggle)
wmii2 2.5.2-11
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 608 kB
  • ctags: 925
  • sloc: ansic: 9,195; makefile: 184; sh: 11
file content (34 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!9PREFIX/bin/rc
# periodically print date and load average to the bar

PIDFILE=/tmp/.ixp-$USER/statuspid-$WMII_IDENT

if(test -r $PIDFILE) {
    kill -2 `{cat $PIDFILE} >[2]/dev/null
}
echo $pid >$PIDFILE

label=`{wmiir read /bar/new}
wmiir write /bar/$label/b1press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$label/b3press 'wmiir write /wm/ctl ''select next'''
wmiir write /bar/$label/b4press 'wmiir write /wm/ctl ''select prev'''
wmiir write /bar/$label/b5press 'wmiir write /wm/ctl ''select next'''

# install signal handler for artificial sigexit:
fn sigint {
    if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
        rm -f $PIDFILE
    wmiir write /bar/ctl 'destroy '^$label
    exit
}

fn statustext {
    # if you need a formatted date, use awk
    echo (`{date} `{uptime | sed 's/.*://; s/,//g'})
}

text=`{statustext}
while(wmiir write /bar/$label/data $"text >[2]/dev/null) {
    sleep 2
    text=`{statustext}
}