From dde08d8de17b12b529d3cbf18958c23586fd7ebe Mon Sep 17 00:00:00 2001 From: Linux User Date: Sat, 17 Sep 2022 03:55:17 +0000 Subject: [PATCH] add batt script --- .local/scripts/0185_10_bat | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .local/scripts/0185_10_bat diff --git a/.local/scripts/0185_10_bat b/.local/scripts/0185_10_bat new file mode 100755 index 0000000..9d3642b --- /dev/null +++ b/.local/scripts/0185_10_bat @@ -0,0 +1,28 @@ +#!/bin/bash + +DEVICE=BAT1 +COLOR1="#FF00F4" +COLOR2="#83007D" + + +batpercent="$(cat /sys/class/power_supply/$DEVICE/capacity)" + +if [[ $((batpercent + 0)) -ge 80 ]] +then + icon="" +elif [[ $((batpercent + 0)) -ge 60 ]] +then + icon="" +elif [[ $((batpercent + 0)) -ge 40 ]] +then + icon="" +elif [[ $((batpercent + 0)) -ge 20 ]] +then + icon="" +else + icon="" +fi + +batpercent="$(echo $batpercent)%" + +echo "^b$COLOR1^^c$COLOR2^ $icon ^c$COLOR1^^b$COLOR2^ $batpercent ^d^"