diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-18 11:44:26 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-18 11:44:26 +0100 |
| commit | 83954961af8b6337da100e038561f2fd975ac1fe (patch) | |
| tree | 33a45dbf91cc4c0b8975287b9537db8aa272505f /batterylow | |
| parent | afd02bfcce54e3252d356f34c25a155c855f3612 (diff) | |
| download | chadscripts-83954961af8b6337da100e038561f2fd975ac1fe.tar.gz chadscripts-83954961af8b6337da100e038561f2fd975ac1fe.tar.bz2 chadscripts-83954961af8b6337da100e038561f2fd975ac1fe.zip | |
Diffstat (limited to 'batterylow')
| -rwxr-xr-x | batterylow | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/batterylow b/batterylow new file mode 100755 index 0000000..cf081d1 --- /dev/null +++ b/batterylow @@ -0,0 +1,14 @@ +#!/bin/sh + +# those variables may be unnecessary +export DISPLAY=:0 +export HOME=/home/filipek + +percentage=$(upower -i "$(upower -e | grep BAT)" | + awk '/percentage/ {gsub(/%/, "", $2); print $2}') + +if [ "$percentage" -le 5 ]; then + notify-send "Battery very low." +elif [ "$percentage" -ge 14 ] && [ "$percentage" -le 15 ]; then + notify-send "Battery low." +fi |
