summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJochen Keil <jochen.keil@gmail.com>2012-08-11 22:21:15 +0200
committerJochen Keil <jochen.keil@gmail.com>2012-08-11 22:21:15 +0200
commita7a2234de9a4f5f7bc5cdd626f40d8505967d1c0 (patch)
tree0ad71fa959ef2c2585ba78bd77bbf70a2483ed67
parentd574e620411a6743805b3f0233b55bfdebfa05c9 (diff)
downloadxmobar-a7a2234de9a4f5f7bc5cdd626f40d8505967d1c0.tar.gz
xmobar-a7a2234de9a4f5f7bc5cdd626f40d8505967d1c0.tar.bz2
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.
-rw-r--r--readme.md29
-rwxr-xr-xsamples/status.sh47
2 files changed, 76 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index 5ea2cc4..e66b438 100644
--- a/readme.md
+++ b/readme.md
@@ -951,6 +951,35 @@ can be used in the output template as `%mydate%`
- Reads its displayed output from the given pipe.
+`BufferedPipeReader Alias [ (Timeout, Bool, "/path/to/pipe1")
+ , (Timeout, Bool, "/path/to/pipe2")
+ , ..
+ ]`
+
+- Display data from multiple pipes.
+- Timeout (in tenth of seconds) is the value after which the previous content is
+ restored i.e. if there was already something from a previous pipe it will be
+ put on display again, overwriting the current status.
+- A pipe with Timout of 0 will be displayed permanently, just like `PipeReader`
+- The boolean option indicates whether new data for this pipe should make xmobar
+ appear (unhide, reveal). In this case, the Timeout additionally specifies when
+ the window should be hidden again. The output is restored in any case.
+- Use it for OSD like status bars e.g. for setting the volume or brightness:
+
+ Run BufferedPipeReader "bpr"
+ [ ( 0, False, "/tmp/xmobar_window" )
+ , ( 15, True, "/tmp/xmobar_status" )
+ ]
+
+ Have your window manager send window titles to `"/tmp/xmobar_window"`. They will
+ always be shown and not reveal your xmobar.
+ Sending some status information to `"/tmp/xmobar_status"` will reveal xmonad
+ for 1.5 seconds and temporarily overwrite the window titles.
+- Take a look at [samples/status.sh]
+
+[samples/status.sh]: http://github.com/jaor/xmobar/raw/master/samples/status.sh
+
+
`XMonadLog`
- Aliases to XMonadLog
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="<fc=$MUTED>"
+ else
+ res="<fc=$NORMAL>"
+ fi
+
+ while [ $i -lt $percent ]; do
+ res+='#'
+ i=$((i+1))
+ done
+
+ res+="</fc><fc=$FGCOLOR>"
+
+ while [ $i -lt 100 ]; do
+ res+='-'
+ i=$((i+1))
+ done
+
+ echo "$res</fc>"
+}
+
+
+echo "$( percentBar )" > "$STATUSPIPE"