chore: add sway and waybar config
This commit is contained in:
18
waybar/scripts/check_battery.sh
Executable file
18
waybar/scripts/check_battery.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
bat=/sys/class/power_supply/BAT1
|
||||
CRIT=${1:-15}
|
||||
|
||||
FILE=~/.config/waybar/scripts/notified
|
||||
|
||||
stat=$(cat $bat/status)
|
||||
perc=$(cat $bat/capacity)
|
||||
|
||||
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
|
||||
if [[ ! -f "$FILE" ]]; then
|
||||
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
|
||||
touch $FILE
|
||||
fi
|
||||
elif [[ -f "$FILE" ]]; then
|
||||
rm $FILE
|
||||
fi
|
Reference in New Issue
Block a user