Last change
on this file was
25,
checked in by simon, 19 years ago
|
Update README with more general instructions. Add wmii status rc script examples.
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | #!/usr/lib/9base/bin/rc |
---|
2 | # periodically print stuff to the bar |
---|
3 | |
---|
4 | PIDFILE=/tmp/.ixp-$USER/statuspid-$WMII_IDENT |
---|
5 | |
---|
6 | if(test -r $PIDFILE) { |
---|
7 | kill -2 `{cat $PIDFILE} >[2]/dev/null |
---|
8 | } |
---|
9 | echo $pid >$PIDFILE |
---|
10 | |
---|
11 | mpdlab=`{wmiir read /bar/new} |
---|
12 | wmiir write /bar/$mpdlab/b1press 'extern mpc prev' |
---|
13 | wmiir write /bar/$mpdlab/b2press 'extern mpc toggle' |
---|
14 | wmiir write /bar/$mpdlab/b3press 'extern mpc next' |
---|
15 | wmiir write /bar/$mpdlab/b4press 'extern mpc volume -5' |
---|
16 | wmiir write /bar/$mpdlab/b5press 'extern mpc volume +5' |
---|
17 | |
---|
18 | # date and load average |
---|
19 | |
---|
20 | label=`{wmiir read /bar/new} |
---|
21 | wmiir write /bar/$label/b1press 'wmiir write /wm/ctl ''select prev''' |
---|
22 | wmiir write /bar/$label/b3press 'wmiir write /wm/ctl ''select next''' |
---|
23 | wmiir write /bar/$label/b4press 'wmiir write /wm/ctl ''select prev''' |
---|
24 | wmiir write /bar/$label/b5press 'wmiir write /wm/ctl ''select next''' |
---|
25 | |
---|
26 | # install signal handler for artificial sigexit: |
---|
27 | fn sigint { |
---|
28 | if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) |
---|
29 | rm -f $PIDFILE |
---|
30 | wmiir write /bar/ctl 'destroy '^$mpdlab |
---|
31 | wmiir write /bar/ctl 'destroy '^$label |
---|
32 | exit |
---|
33 | } |
---|
34 | |
---|
35 | fn mpdstatus { |
---|
36 | echo (`{python2.4 $HOME/.wmii/scripts/mpc.py}) |
---|
37 | } |
---|
38 | |
---|
39 | fn statustext { |
---|
40 | # if you need a formatted date, use awk |
---|
41 | echo (`{date} `{uptime | sed 's/.*://; s/,//g'}) |
---|
42 | } |
---|
43 | |
---|
44 | mpdtext=`{mpdstatus} |
---|
45 | text=`{statustext} |
---|
46 | while(wmiir write /bar/$mpdlab/data $"mpdtext >[2]/dev/null; wmiir write /bar/$label/data $"text >[2]/dev/null) { |
---|
47 | sleep 2 |
---|
48 | mpdtext=`{mpdstatus} |
---|
49 | text=`{statustext} |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.