From 331f04f73fe77e27384756813a06c628d3e2131b Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Wed, 11 May 2022 12:27:21 +0200 Subject: [PATCH] Colorize battery statusbar script --- .bin/check-battery-level | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.bin/check-battery-level b/.bin/check-battery-level index bd968bc..adda65a 100755 --- a/.bin/check-battery-level +++ b/.bin/check-battery-level @@ -1,5 +1,13 @@ #!/usr/bin/env bash -capacityStatus="$(cat /sys/class/power_supply/BAT0/capacity)" +cap="$(cat /sys/class/power_supply/BAT0/capacity)" -printf "$capacityStatus%%" +if [ "$cap" -ge 33 ];then + color="\x01" +elif [ "$cap" -ge 10 ]; then + color="\x03" +else + color="\x04" +fi + +echo -n -e "$color $cap%"