commit 5a35c4bd563235acd652f4603a5673fc05b35fc5 parent 3f040b6f950798e0efdd12a5e7012e23ca76f715 Author: jacobsGit <JacobDoesLinux@protonmail.com> Date: Mon, 9 Dec 2019 15:57:52 -0800 added functionality to xmb-battery Diffstat:
| M | xmobar/.xmobar/xmb-battery | | | 40 | +++++++++++++++++++++++++++++++--------- |
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/xmobar/.xmobar/xmb-battery b/xmobar/.xmobar/xmb-battery @@ -6,20 +6,43 @@ suspendAt=10 # percent suspendDelay=30 # in seconds -batteryMsg='' -poweredMsg='AC' + +batteryPrefix='-' +batterySuffix='%%' +batteryColor='ff8f8f' + +poweredPrefix='+' +poweredSuffix='%%' +poweredColor='8fff8f' + +fullColor='1a1a1a' +fullSuffix='<fc=#1a1a1a>%%</fc>' +fullPrefix=' ' + + + + + + status="$(acpi -a | awk '{print $3}')" percentage="$(acpi -b | cut -d '%' -f 1 | rev | awk '{print $1}' | rev )" +if [[ "$status" = 'on-line' ]] && [[ "$percentage" -ge '100' ]]; then + statusPrefix="$fullPrefix" + suffix="$fullSuffix" + color="<fc=#$fullColor>" + +elif [[ "$status" = 'on-line' ]]; then + statusPrefix="$poweredPrefix" + suffix="$poweredSuffix" + color="<fc=#$poweredColor>" -if [[ "$status" = 'on-line' ]]; then - statusMsg="$poweredMsg" - color='<fc=#8fff8f>' elif [[ "$status" = 'off-line' ]]; then - statusMsg="$batteryMsg" - color='<fc=#ff8f8f>' + statusPrefix="$batteryPrefix" + suffix="$batterySuffix" + color="<fc=#$batteryColor>" fi @@ -37,5 +60,4 @@ fi - -printf "<fc=#5f5f5f>$statusMsg</fc> $color$percentage</fc>%%" +printf "<fc=#5f5f5f>$statusPrefix</fc> $color$percentage</fc>$suffix"