All pastes #778600 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-17 19:19 UTC
rendered paste body
battery() {
    LEVEL=`acpi -b | awk '{print $4}' | sed -e 's/%,//'`
    STATE=`acpi -b | awk '{print $3}'`

    if [ $STATE != "discharging," ]; then
        echo "^fg(green)On external power^fg()"
    else
        if [ $LEVEL -ge 20 ]; then
            FGCOLOR=green
            BGCOLOR=$GLOBALBGCOLOR
        elif [ $LEVEL -ge 10 ]; then
            FGCOLOR=black
            BGCOLOR=yellow
        else
            FGCOLOR=black
            BGCOLOR=red
        fi

        echo $LEVEL | gdbar -fg $FGCOLOR -bg $BGCOLOR -nonl -l Battery:
    fi
}