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 $@
|
@@ -4,4 +4,4 @@ main() {
|
||||
checkupdates | wc -l
|
||||
}
|
||||
|
||||
main $@
|
||||
main $@
|
@@ -1,41 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
file=~/.config/waybar/scripts/lowbat
|
||||
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%"
|
||||
if [[ ! -f "$file" ]]; then
|
||||
pid="$(notify-send --print-id --urgency=critical --icon=dialog-warning "$title" "$body")"
|
||||
else
|
||||
pid="$(notify-send --print-id --replace-id="$(cat $file)" --urgency=critical --icon=dialog-warning "$title" "$body")"
|
||||
fi
|
||||
|
||||
echo $pid > $file
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ "$stat" == "Discharging" ]] && [[ "$perc" -le "$crit" ]] && [[ ! -f "$file" ]]; then
|
||||
notifysend
|
||||
fi
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
case "$stat" in
|
||||
"Charging" )
|
||||
rm $file
|
||||
;;
|
||||
"Discharging" )
|
||||
notifysend
|
||||
;;
|
||||
* );;
|
||||
esac
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
12
.config/waybar/scripts/close-screen-recorder.sh
Executable file
12
.config/waybar/scripts/close-screen-recorder.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
main() {
|
||||
pid="$(pgrep "wf-recorder" || pgrep "slurp")"
|
||||
status=$?
|
||||
|
||||
if [[ $status == 0 ]]; then
|
||||
pkill --signal SIGINT wf-recorder
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
Reference in New Issue
Block a user