diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-08-13 15:11:55 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-08-13 15:12:11 +0200 |
commit | 359769944a8cb0ac80537458af0e49cc8f68d01b (patch) | |
tree | 484068988be1571b25ff0a81c7e74cb9cd579325 /samples | |
parent | 73837127825529d44e2e0d4ed440da0d7b180020 (diff) | |
parent | 05f268c3a831325f65a662c6ccdff75a1c441d83 (diff) | |
download | xmobar-359769944a8cb0ac80537458af0e49cc8f68d01b.tar.gz xmobar-359769944a8cb0ac80537458af0e49cc8f68d01b.tar.bz2 |
Merge for pull request #53
Diffstat (limited to 'samples')
-rwxr-xr-x | samples/status.sh | 54 | ||||
-rw-r--r-- | samples/xmobar.config | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/samples/status.sh b/samples/status.sh new file mode 100755 index 0000000..94e8fe7 --- /dev/null +++ b/samples/status.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +STATUSPIPE="/tmp/xmobar_status_jrk" + +function isMuted () { + # retrieve mute status + # return an arbitrary string for true or nothing at all + echo +} + +function getPercent () { + # somehow retrieve the percent value as plain int (e.g. "66") + echo "66" +} + +function percentBar () { + local i=1 res= + normal=47 high=80 + fgColor='#657b83' mutedColor='#cb4b16' + lowColor='#859900' midColor='#b58900' + highColor='#cb4b16' + + bar="$(echo -ne "\u2588")" + percent="$( getPercent )" + muted="$( isMuted )" + + if [ -n "$muted" ]; then + res="<fc=$mutedColor>" + else + res="<fc=$lowColor>" + fi + + while [ $i -lt $percent ]; do + if [ $i -eq $normal -a -z "$muted" ]; then + res+="</fc><fc=$midColor>" + elif [ $i -eq $high -a -z "$muted" ]; then + res+="</fc><fc=$highColor>" + fi + + res+=$bar + i=$((i+1)) + done + + res+="</fc><fc=$fgColor>" + + while [ $i -lt 100 ]; do + res+='-' + i=$((i+1)) + done + + echo "$res</fc>" +} + +echo "$( percentBar )" > "$STATUSPIPE" diff --git a/samples/xmobar.config b/samples/xmobar.config index 1e41945..faf6ac6 100644 --- a/samples/xmobar.config +++ b/samples/xmobar.config @@ -5,6 +5,7 @@ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , fgColor = "grey" , position = Top , lowerOnStart = True + , persistent = False , commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000 , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10 |