chore(waybar): update config

This commit is contained in:
2025-03-01 10:49:06 +01:00
parent 2197cd038f
commit 244b4808fa
3 changed files with 144 additions and 137 deletions

View File

@@ -1,18 +1,17 @@
#!/bin/sh
#! /usr/bin/env bash
bat=/sys/class/power_supply/BAT1
CRIT=${1:-15}
FILE=~/.config/waybar/scripts/.low_bat
FILE=~/.config/waybar/scripts/notified
bat="/sys/class/power_supply/BAT1"
CRIT="${1:-15}"
stat="$(cat $bat/status)"
perc="$(cat $bat/capacity)"
stat=$(cat $bat/status)
perc=$(cat $bat/capacity)
if [[ $perc -le $CRIT ]] && [[ "$stat" == "Discharging" ]] && [[ ! -f "$FILE" ]]; then
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
touch $FILE
fi
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
if [[ -f "$FILE" ]] && [[ "$stat" == "Charging" ]]; then
rm $FILE
fi