From 45b80e8e67a2ea724d6f7317428cccf7ea9db395 Mon Sep 17 00:00:00 2001 From: dx Date: Sat, 6 Jun 2020 19:31:36 +0100 Subject: ~set_bar -> scripts/status/* Decomposed the set_bar monolith script into seperate 'block' scripts --- Scripts/.local/scripts/status/battery | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 Scripts/.local/scripts/status/battery (limited to 'Scripts/.local/scripts/status/battery') diff --git a/Scripts/.local/scripts/status/battery b/Scripts/.local/scripts/status/battery new file mode 100755 index 0000000..7680ac5 --- /dev/null +++ b/Scripts/.local/scripts/status/battery @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break +status=$(cat /sys/class/power_supply/BAT0/status) + +if [[ $status == "Charging" ]] +then + status="" +else + if [[ $capacity -ge 75 ]] + then + status="" + elif [[ $capacity -ge 50 ]] + then + status="" + elif [[ $capacity -ge 25 ]] + then + status="" + elif [[ $capacity -ge 10 ]] + then + status="" + else + status="" + fi +fi +echo "$status $capacity%" -- cgit v1.2.3-13-gbd6f