diff --git a/config/dunst/notify-waybar.sh b/config/dunst/notify-waybar.sh index 6125b43..9f7375b 100755 --- a/config/dunst/notify-waybar.sh +++ b/config/dunst/notify-waybar.sh @@ -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) & diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 34c56ec..68317a4 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -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 ### diff --git a/config/wal/generate.py b/config/wal/generate.py index a46738c..fbd5baa 100644 --- a/config/wal/generate.py +++ b/config/wal/generate.py @@ -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; }} diff --git a/config/wal/reload.sh b/config/wal/reload.sh index f078c49..9867b4c 100755 --- a/config/wal/reload.sh +++ b/config/wal/reload.sh @@ -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) diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc index bd22c3a..3efa280 100644 --- a/config/waybar/config.jsonc +++ b/config/waybar/config.jsonc @@ -29,6 +29,7 @@ "format-window-separator": " ", "window-rewrite-default": "", "window-rewrite": { + "class": "", "class": "", "class": "", "class": "", @@ -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" }, diff --git a/config/waybar/notif-status.sh b/config/waybar/notif-status.sh new file mode 100755 index 0000000..de476bd --- /dev/null +++ b/config/waybar/notif-status.sh @@ -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" diff --git a/install.sh b/install.sh index acb6559..8fc1af2 100755 --- a/install.sh +++ b/install.sh @@ -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 "" diff --git a/scripts/battery-watch.sh b/scripts/battery-watch.sh new file mode 100755 index 0000000..a132bce --- /dev/null +++ b/scripts/battery-watch.sh @@ -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