From d433166f0bb3e1d7e8da20c1d9007bee2b39e522 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 11 Aug 2012 21:56:12 +0200 Subject: Add sample option for persistent and update option description Description for lowerOnStart was missing. --- samples/xmobar.config | 1 + 1 file changed, 1 insertion(+) (limited to 'samples') 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",": 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 -- cgit v1.2.3 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. --- readme.md | 29 +++++++++++++++++++++++++++++ samples/status.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100755 samples/status.sh (limited to 'samples') 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="" + 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 From abb0b488741fc2f20a1486a6f122f7f6fa38e92d Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sun, 12 Aug 2012 11:33:54 +0200 Subject: Fancier status script sample This sample script uses colors and unicode signs for drawing a status bar for e.g. volume. The unicode character can be simply changed to an ascii one in case of problems. --- samples/status.sh | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'samples') diff --git a/samples/status.sh b/samples/status.sh index fc8af11..c84d7f2 100755 --- a/samples/status.sh +++ b/samples/status.sh @@ -1,10 +1,6 @@ #!/bin/sh - STATUSPIPE="/tmp/xmobar_status_jrk" -NORMAL='#eee8d5' -MUTED='#cb4b16' -FGCOLOR="#657b83" function isMuted () { # retrieve mute status @@ -17,23 +13,35 @@ function getPercent () { echo "66" } - function percentBar () { - local res= i=1 - local percent=$( getPercent ) - - if [ -n "$( isMuted )" ]; then - res="" + 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="" else - res="" + res="" fi while [ $i -lt $percent ]; do - res+='#' + if [ $i -eq $normal -a -z "$muted" ]; then + res+="" + elif [ $i -eq $high -a -z "$muted" ]; then + res+="" + fi + + res+=$bar i=$((i+1)) done - res+="" + res+="" while [ $i -lt 100 ]; do res+='-' @@ -43,5 +51,4 @@ function percentBar () { echo "$res" } - echo "$( percentBar )" > "$STATUSPIPE" -- cgit v1.2.3 From bd6ea2a17e3bb779d5e8d787ffcb170fecc92043 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Mon, 13 Aug 2012 07:31:41 +0200 Subject: sh is not linked to bash on all systems This is a bash script, so for correctness is needs to be /bin/bash --- samples/status.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'samples') diff --git a/samples/status.sh b/samples/status.sh index c84d7f2..94e8fe7 100755 --- a/samples/status.sh +++ b/samples/status.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash STATUSPIPE="/tmp/xmobar_status_jrk" -- cgit v1.2.3