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