aboutsummaryrefslogtreecommitdiff
path: root/.scripts/batnot
diff options
context:
space:
mode:
authorMarvin Borner2022-11-01 14:13:08 +0100
committerMarvin Borner2022-11-01 14:13:08 +0100
commit29c894db157e9b2bb2a392e0abb83ac700a839d5 (patch)
tree1e630bfabf1d94b61a88ab7b6e8b631113b6f7fd /.scripts/batnot
parent600de714ba13c1ccd54357554898db909de5af81 (diff)
sync
Diffstat (limited to '.scripts/batnot')
-rwxr-xr-x.scripts/batnot13
1 files changed, 13 insertions, 0 deletions
diff --git a/.scripts/batnot b/.scripts/batnot
new file mode 100755
index 0000000..b8fa5ae
--- /dev/null
+++ b/.scripts/batnot
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+bat=$(cat /sys/class/power_supply/BAT0/capacity)
+state=$(cat /sys/class/power_supply/BAT0/status)
+
+if [ "$bat" -le 7 ] && [ "$state" != "Charging" ]; then
+ export XAUTHORITY=/home/melvin/.Xauthority
+ export DISPLAY=:0
+ export XDG_RUNTIME_DIR=/run/user/1000
+ export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+
+ notify-send -u critical "Battery low" "Battery level is at $bat%!"
+fi