script: battery-notify check if we are already on AC
This commit is contained in:
parent
eebfbdf622
commit
45ed3a8081
@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
BATTERY_LEVEL=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | awk '{print $2}' | sed 's/%//')
|
||||
|
||||
AC_POWER=$(cat /sys/class/power_supply/AC0/online)
|
||||
if [ $AC_POWER -eq 1 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $BATTERY_LEVEL -le 5 ]; then
|
||||
notify-send "Low Battery" "Battery level is ${BATTERY_LEVEL}%" -u critical
|
||||
exit
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user