chore: update configs
This commit is contained in:
22
.config/waybar/scripts/check-battery.sh
Executable file
22
.config/waybar/scripts/check-battery.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
bat="/sys/class/power_supply/BAT1"
|
||||
crit="${1:-15}"
|
||||
stat="$(cat $bat/status)"
|
||||
perc="$(cat $bat/capacity)"
|
||||
|
||||
notifysend() {
|
||||
local pid
|
||||
local title="Low Battery"
|
||||
local body="Current charge: $perc%"
|
||||
|
||||
notify-send --print-id --urgency=critical --icon=dialog-warning "$title" "$body"
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ "$stat" == "Discharging" ]] && [[ "$perc" -le "$crit" ]] && [[ ! -f "$file" ]]; then
|
||||
notifysend
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
Reference in New Issue
Block a user