tCleaned output by testing itself - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit dd57f6c1e3123fc21b867b38d8d5ca689df42f6c
 (DIR) parent b9633c3869060d77c139b6768fc98a92b820d838
 (HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
       Date:   Mon,  4 Nov 2013 08:39:44 +0100
       
       Cleaned output by testing itself
       
       Diffstat:
         M bar/config.sh                       |       2 +-
         M bar/status.sh                       |      30 ++++++++++++++++--------------
       
       2 files changed, 17 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/bar/config.sh b/bar/config.sh
       t@@ -16,7 +16,7 @@ fg="9"
        hl="8"
        
        # separator
       -sp="  "
       +sp=" "
        
        # path to executable
        bar="/usr/bin/bar -f"
 (DIR) diff --git a/bar/status.sh b/bar/status.sh
       t@@ -24,9 +24,11 @@ function bg() {
        
        # print formatted output. need 2 params: display <value> <icon>
        function display () {
       -    echo -n     "$(fg $OUT ${hl})"
       -    echo -en    "$2 "
       -    echo        "$(fg $OUT ${fg})$1"
       +    if [ -n "$1" ]; then
       +        echo -n     "$(fg $OUT ${hl})"
       +        echo -en    "$2 "
       +        echo        "$(fg $OUT ${fg})$1"
       +    fi
        }
        
        function workspaces () {
       t@@ -204,17 +206,17 @@ function fillbar () {
                    O) OUT=$OPTARG ;;
        
                    # Content of the output
       -            b) buffer="${buffer}$(battery) ${sp}"           ;;
       -            c) buffer="${buffer}$(clock) ${sp}"             ;;
       -            f) buffer="${buffer}$(gpufanspeed) ${sp}"       ;;
       -            l) buffer="${buffer}$(mpd_now_playing) ${sp}"   ;;
       -            m) buffer="${buffer}$(mails) ${sp}"             ;;
       -            n) buffer="${buffer}$(network) ${sp}"           ;;
       -            p) buffer="${buffer}$(processes) ${sp}"         ;;
       -            r) buffer="${buffer}$(memory) ${sp}"            ;;
       -            t) buffer="${buffer}$(gputemp) ${sp}"           ;;
       -            v) buffer="${buffer}$(volume) ${sp}"            ;;
       -            w) buffer="${buffer}$(groups) ${sp}"            ;;
       +            b) [[ -n "$(battery)" ]] && buffer="${buffer}$(battery) ${sp}"           ;;
       +            c) [[ -n "$(clock)" ]] && buffer="${buffer}$(clock) ${sp}"             ;;
       +            f) [[ -n "$(gpufanspeed)" ]] && buffer="${buffer}$(gpufanspeed) ${sp}"       ;;
       +            l) [[ -n "$(mpd_now_playing)" ]] && buffer="${buffer}$(mpd_now_playing) ${sp}"   ;;
       +            m) [[ -n "$(mails)" ]] && buffer="${buffer}$(mails) ${sp}"             ;;
       +            n) [[ -n "$(network)" ]] && buffer="${buffer}$(network) ${sp}"           ;;
       +            p) [[ -n "$(processes)" ]] && buffer="${buffer}$(processes) ${sp}"         ;;
       +            r) [[ -n "$(memory)" ]] && buffer="${buffer}$(memory) ${sp}"            ;;
       +            t) [[ -n "$(gputemp)" ]] && buffer="${buffer}$(gputemp) ${sp}"           ;;
       +            v) [[ -n "$(volume)" ]] && buffer="${buffer}$(volume) ${sp}"            ;;
       +            w) [[ -n "$(groups)" ]] && buffer="${buffer}$(groups) ${sp}"            ;;
                esac
            done