feat: add battery-watch daemon and notification urgency support

- new battery-watch daemon: warnt bei 25% und 15% per dunst-Notification
- notify-waybar.sh schreibt jetzt auch Urgency-Level in /tmp
- notif-status.sh: neues waybar-Skript mit urgency-CSS-Klasse
- hyprland.conf: battery-watch als exec-once, clipboard-bind entfernt
- config.jsonc: Brave-Icon hinzugefügt, Battery-Schwellen auf 25/15 korrigiert
- generate.py: Font Awesome Brands ergänzt, transition:none für critical-blink
- reload.sh: waybar-Start korrigiert (disown als eigene Zeile)
- install.sh: startet dunst und battery-watch nach Theme-Load neu
This commit is contained in:
2026-04-22 20:56:34 +02:00
parent 8c6ae68298
commit e84a2d888a
8 changed files with 66 additions and 7 deletions
+3 -2
View File
@@ -2,10 +2,11 @@
SUMMARY="$DUNST_SUMMARY"
APP="$DUNST_APP_NAME"
BODY="$DUNST_BODY"
URGENCY="${DUNST_URGENCY,,}" # lowercase: low, normal, critical
[ -z "$SUMMARY" ] && exit 0
echo "${APP}: ${SUMMARY}${BODY:+ — $BODY}" > /tmp/waybar-notif
echo "$URGENCY" > /tmp/waybar-notif-urgency
# Datei nach 10 Sekunden automatisch leeren
(sleep 10 && rm -f /tmp/waybar-notif) &
(sleep 10 && rm -f /tmp/waybar-notif /tmp/waybar-notif-urgency) &
+1 -1
View File
@@ -61,6 +61,7 @@ exec-once = awww-daemon
# Notification Demon
exec-once = dunst
exec-once = ~/.local/bin/battery-watch
# Bluetooth Tray-Applet (blueman) - Maus/Geräte pairen per Klick im Waybar-Tray
exec-once = blueman-applet
@@ -353,7 +354,6 @@ bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous
bind = CTRL SHIFT, V, exec, wl-paste | wtype -
##############################
### WINDOWS AND WORKSPACES ###
+2 -1
View File
@@ -26,7 +26,7 @@ def rgba(h, a):
waybar = f"""/* Generated — edit ~/.active_theme/colors.json */
* {{
font-family: "MesloLGS Nerd Font Mono", "Font Awesome 7 Free", monospace;
font-family: "MesloLGS Nerd Font Mono", "Font Awesome 7 Free", "Font Awesome 7 Brands", monospace;
font-size: 11px;
font-weight: normal;
min-height: 0;
@@ -130,6 +130,7 @@ window#waybar.bottom {{
#battery.critical {{
color: {pink};
transition: none;
animation: blink 1s steps(1) infinite;
}}
+2 -1
View File
@@ -13,7 +13,8 @@ ln -sf ~/.cache/wal/wofi-style.css ~/.config/wofi/style.css
bash ~/.cache/wal/hypr-apply.sh
# Restart waybar
pkill waybar; sleep 0.3; waybar &disown
pkill waybar; sleep 0.3; waybar > /dev/null 2>&1 &
disown
# Switch wallpaper only if it changed
WALLPAPER=$(cat ~/.cache/wal/wallpaper 2>/dev/null)
+3 -2
View File
@@ -29,6 +29,7 @@
"format-window-separator": " ",
"window-rewrite-default": "",
"window-rewrite": {
"class<brave-browser>": "",
"class<kitty>": "",
"class<foot>": "",
"class<Alacritty>": "",
@@ -94,8 +95,8 @@
"format-plugged": "\uf1e6 {capacity}%",
"format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"],
"states": {
"warning": 85,
"critical": 80
"warning": 25,
"critical": 15
},
"tooltip-format": "{timeTo}, {power:.1f}W"
},
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
if [ ! -f /tmp/waybar-notif ]; then
printf '{"text":"","class":""}\n'
exit 0
fi
text=$(cat /tmp/waybar-notif)
urgency=$(cat /tmp/waybar-notif-urgency 2>/dev/null | tr '[:upper:]' '[:lower:]')
urgency="${urgency:-normal}"
icon=$''
# Escape backslashes and quotes in text to keep JSON valid
text=$(printf '%s' "$text" | sed 's/\\/\\\\/g; s/"/\\"/g')
printf '{"text":"%s %s","class":"%s"}\n' "$icon" "$text" "$urgency"
+11
View File
@@ -62,6 +62,17 @@ echo ""
echo "Loading theme..."
~/.config/wal/reload.sh
# Restart dunst so new dunstrc and scripts take effect
pkill dunst 2>/dev/null; sleep 0.1; dunst > /dev/null 2>&1 &
disown
echo " restarted dunst"
# Start battery-watch for current session (exec-once handles future logins)
pkill -f battery-watch 2>/dev/null
~/.local/bin/battery-watch > /dev/null 2>&1 &
disown
echo " started battery-watch"
echo ""
echo "Profile '$PROFILE_NAME' installed."
echo ""
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# Battery monitor daemon - started via hyprland exec-once
WARNED_25=false
WARNED_15=false
while true; do
capacity=$(cat /sys/class/power_supply/BAT*/capacity 2>/dev/null | head -1)
status=$(cat /sys/class/power_supply/BAT*/status 2>/dev/null | head -1)
if [ -z "$capacity" ]; then
sleep 60
continue
fi
if [ "$status" = "Charging" ] || [ "$status" = "Full" ]; then
WARNED_25=false
WARNED_15=false
sleep 60
continue
fi
if [ "$capacity" -le 15 ] && [ "$WARNED_15" = false ]; then
dunstify -u critical -a "Batterie" "Akku kritisch: ${capacity}%" "Sofort aufladen!"
WARNED_15=true
WARNED_25=true
elif [ "$capacity" -le 25 ] && [ "$WARNED_25" = false ]; then
dunstify -u critical -a "Batterie" "Akkuwarnung: ${capacity}%" "Bitte laden."
WARNED_25=true
fi
sleep 60
done