notifications are for `dunst` a notification handler for my setup I added volume, charging, battery, time, and brightness notifications
11 lines
622 B
Bash
Executable file
11 lines
622 B
Bash
Executable file
#!/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")
|
|
|
|
if [[ $DISCHARGING_COUNT -eq 0 ]]; 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
|
|
fi
|