fix: changing FULL_BATTERY value + add condition + var add

mild fixes + additions
This commit is contained in:
devaine 2025-04-26 13:32:10 -05:00
commit db605c6c98
Signed by untrusted user who does not match committer: devaine
GPG key ID: 954B1DCAC6FF84EE
2 changed files with 6 additions and 4 deletions

View file

@ -1,10 +1,10 @@
#!/bin/bash
BATTERY=$(acpi | grep -vwE "(unavailable)" | grep -o '[0-9]' | head -n 1)
BAT_PERCENT=$(acpi -b | grep "Battery $BATTERY" | grep -P -o "[0-9]+(?=%)")
DISCHARGING_COUNT=$(acpi -b | grep "Battery $BATTERY" | grep "until" | grep -c "Discharging")
#NOTCHARGING_COUNT=$(acpi -b | head -n 1 | grep -c "Not Charging")
DISCHARGING_COUNT=$(acpi -b | grep "Battery $BATTERY" | grep -E "until|remaining" | grep -c "Discharging")
NOTCHARGING_COUNT=$(acpi -b | grep "Battery $BATTERY" | grep -c "Not Charging")
if [[ $DISCHARGING_COUNT -eq 0 ]]; then
if [[ $DISCHARGING_COUNT -eq 0 ]] || [[ $NOTCHARGING_COUNT -eq 1 ]]; then
dunstify "Battery Status" "Battery is currently charging at ${BAT_PERCENT}%" -i "battery-level-50-charging-symbolic" -r 9991 -t 5000
else
dunstify "Battery Status" "Battery is currently at ${BAT_PERCENT}%" -i "battery-level-50-symbolic" -r 9991 -t 5000