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:
@@ -2,10 +2,11 @@
|
|||||||
SUMMARY="$DUNST_SUMMARY"
|
SUMMARY="$DUNST_SUMMARY"
|
||||||
APP="$DUNST_APP_NAME"
|
APP="$DUNST_APP_NAME"
|
||||||
BODY="$DUNST_BODY"
|
BODY="$DUNST_BODY"
|
||||||
|
URGENCY="${DUNST_URGENCY,,}" # lowercase: low, normal, critical
|
||||||
|
|
||||||
[ -z "$SUMMARY" ] && exit 0
|
[ -z "$SUMMARY" ] && exit 0
|
||||||
|
|
||||||
echo "${APP}: ${SUMMARY}${BODY:+ — $BODY}" > /tmp/waybar-notif
|
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 /tmp/waybar-notif-urgency) &
|
||||||
(sleep 10 && rm -f /tmp/waybar-notif) &
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ exec-once = awww-daemon
|
|||||||
|
|
||||||
# Notification Demon
|
# Notification Demon
|
||||||
exec-once = dunst
|
exec-once = dunst
|
||||||
|
exec-once = ~/.local/bin/battery-watch
|
||||||
|
|
||||||
# Bluetooth Tray-Applet (blueman) - Maus/Geräte pairen per Klick im Waybar-Tray
|
# Bluetooth Tray-Applet (blueman) - Maus/Geräte pairen per Klick im Waybar-Tray
|
||||||
exec-once = blueman-applet
|
exec-once = blueman-applet
|
||||||
@@ -353,7 +354,6 @@ bindl = , XF86AudioNext, exec, playerctl next
|
|||||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
bindl = , XF86AudioPause, exec, playerctl play-pause
|
||||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
||||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
bindl = , XF86AudioPrev, exec, playerctl previous
|
||||||
bind = CTRL SHIFT, V, exec, wl-paste | wtype -
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
### WINDOWS AND WORKSPACES ###
|
### WINDOWS AND WORKSPACES ###
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def rgba(h, a):
|
|||||||
waybar = f"""/* Generated — edit ~/.active_theme/colors.json */
|
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-size: 11px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -130,6 +130,7 @@ window#waybar.bottom {{
|
|||||||
|
|
||||||
#battery.critical {{
|
#battery.critical {{
|
||||||
color: {pink};
|
color: {pink};
|
||||||
|
transition: none;
|
||||||
animation: blink 1s steps(1) infinite;
|
animation: blink 1s steps(1) infinite;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ ln -sf ~/.cache/wal/wofi-style.css ~/.config/wofi/style.css
|
|||||||
bash ~/.cache/wal/hypr-apply.sh
|
bash ~/.cache/wal/hypr-apply.sh
|
||||||
|
|
||||||
# Restart waybar
|
# 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
|
# Switch wallpaper only if it changed
|
||||||
WALLPAPER=$(cat ~/.cache/wal/wallpaper 2>/dev/null)
|
WALLPAPER=$(cat ~/.cache/wal/wallpaper 2>/dev/null)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"format-window-separator": " ",
|
"format-window-separator": " ",
|
||||||
"window-rewrite-default": "",
|
"window-rewrite-default": "",
|
||||||
"window-rewrite": {
|
"window-rewrite": {
|
||||||
|
"class<brave-browser>": "",
|
||||||
"class<kitty>": "",
|
"class<kitty>": "",
|
||||||
"class<foot>": "",
|
"class<foot>": "",
|
||||||
"class<Alacritty>": "",
|
"class<Alacritty>": "",
|
||||||
@@ -94,8 +95,8 @@
|
|||||||
"format-plugged": "\uf1e6 {capacity}%",
|
"format-plugged": "\uf1e6 {capacity}%",
|
||||||
"format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"],
|
"format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"],
|
||||||
"states": {
|
"states": {
|
||||||
"warning": 85,
|
"warning": 25,
|
||||||
"critical": 80
|
"critical": 15
|
||||||
},
|
},
|
||||||
"tooltip-format": "{timeTo}, {power:.1f}W"
|
"tooltip-format": "{timeTo}, {power:.1f}W"
|
||||||
},
|
},
|
||||||
|
|||||||
Executable
+12
@@ -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
@@ -62,6 +62,17 @@ echo ""
|
|||||||
echo "Loading theme..."
|
echo "Loading theme..."
|
||||||
~/.config/wal/reload.sh
|
~/.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 ""
|
||||||
echo "Profile '$PROFILE_NAME' installed."
|
echo "Profile '$PROFILE_NAME' installed."
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Executable
+32
@@ -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
|
||||||
Reference in New Issue
Block a user