From a7a2234de9a4f5f7bc5cdd626f40d8505967d1c0 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 11 Aug 2012 22:21:15 +0200 Subject: Documentation for the BufferedPipeReader plugin (+ sample script) The sample script is quite generic. It works for demo purposes and can be used as a template for users to write their own scripts. --- samples/status.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 samples/status.sh (limited to 'samples') diff --git a/samples/status.sh b/samples/status.sh new file mode 100755 index 0000000..fc8af11 --- /dev/null +++ b/samples/status.sh @@ -0,0 +1,47 @@ +#!/bin/sh + + +STATUSPIPE="/tmp/xmobar_status_jrk" +NORMAL='#eee8d5' +MUTED='#cb4b16' +FGCOLOR="#657b83" + +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 res= i=1 + local percent=$( getPercent ) + + if [ -n "$( isMuted )" ]; then + res="" + else + res="" + fi + + while [ $i -lt $percent ]; do + res+='#' + i=$((i+1)) + done + + res+="" + + while [ $i -lt 100 ]; do + res+='-' + i=$((i+1)) + done + + echo "$res" +} + + +echo "$( percentBar )" > "$STATUSPIPE" -- cgit v1.2.3