aboutsummaryrefslogtreecommitdiff
path: root/.scripts/batnot
blob: b8fa5ae3fd74abf3b3bf722d4d8263758e7f25cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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