From 29c894db157e9b2bb2a392e0abb83ac700a839d5 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 1 Nov 2022 14:13:08 +0100 Subject: sync --- .scripts/batnot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 .scripts/batnot (limited to '.scripts/batnot') 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 -- cgit v1.2.3