123456789101112131415161718192021222324252627282930313233343536 |
- #!/bin/sh
- SLEEP_SEC=20
- xclock -digital -strftime "" -g 60x20-0-0 -fg black -bg gray80 -padding 2 -face "DejaVu Sans Mono:pixelsize=14" &
- PID=$!
- while ( true ); do
- BAT=`envstat -d acpibat0 | awk '
- BEGIN {
- p = "0%";
- s = "-";
- }
- $6 != Unit && $6 != "" {
- p=substr($6, 2, length($6)-2);
- }
- $1 == "charging" {
- if($2 == "TRUE")
- s = "+";
- }
- END {
- printf("%s%s", s,p);
- }'`
- kill $PID
- xclock -digital -strftime "$BAT" -g 60x20-0-0 -fg black -bg gray80 -padding 2 -face "DejaVu Sans Mono:pixelsize=14" &
- PID=$!
- sleep $SLEEP_SEC
- done
- #while :; do
- # sleep $SLEEP_SEC
- #done
|