summaryrefslogtreecommitdiff
path: root/local/.local/scripts/checkBat
diff options
context:
space:
mode:
authorRasmus <rasmus.luha@gmail.com>2023-04-08 00:27:03 +0300
committerRasmus <rasmus.luha@gmail.com>2023-04-08 00:27:03 +0300
commita16bdfe930d89e1a7fb354b78d16e8742118f76d (patch)
treef32aabd929a485ac24ea2b3fb1c9c9d041f27478 /local/.local/scripts/checkBat
checkers
Diffstat (limited to 'local/.local/scripts/checkBat')
-rwxr-xr-xlocal/.local/scripts/checkBat11
1 files changed, 11 insertions, 0 deletions
diff --git a/local/.local/scripts/checkBat b/local/.local/scripts/checkBat
new file mode 100755
index 0000000..a599409
--- /dev/null
+++ b/local/.local/scripts/checkBat
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+PERCENT0=$(cat /sys/class/power_supply/BAT0/capacity)
+PERCENT1=$(cat /sys/class/power_supply/BAT1/capacity)
+PERCENT=$(( ($PERCENT0 + $PERCENT1) / 2))
+
+CHARGING0=$(cat /sys/class/power_supply/BAT0/status)
+CHARGING1=$(cat /sys/class/power_supply/BAT1/status)
+
+[[ "$CHARGING0" == "Charging" || "$CHARGING1" == "Charging" ]] && exit;
+[ "$PERCENT" -le 15 ] && notify-send "Brrr" "<15% | Low Bat"