mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-23 12:03:55 -05:00
Aly Raffauf
069576df3d
* mako: setup binPath * swayidle: setup binPath * randomWallpaper: make bin PATH and move script to separate file * waybar: setup binPath * hyprland,sway: don't import all vars for systemd services
19 lines
469 B
Bash
Executable file
19 lines
469 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
if [ -d /sys/class/power_supply/BAT0 ]; then
|
|
BAT=/sys/class/power_supply/BAT0
|
|
elif [ -d /sys/class/power_supply/BAT1 ]; then
|
|
BAT=/sys/class/power_supply/BAT1
|
|
else
|
|
echo "No battery found."
|
|
exit 1
|
|
fi
|
|
|
|
CRIT=''${1:-10}
|
|
STAT=$(cat $BAT/status)
|
|
PERC=$(cat $BAT/capacity)
|
|
|
|
if [[ $PERC -le $CRIT ]] && [[ $STAT == "Discharging" ]]; then
|
|
notify-send --urgency=critical --icon=dialog-error "Battery Critical" "Current charge: $PERC%".
|
|
fi
|