diff --git a/modules/home/wayland/apps/eww/bar/modules/clock.yuck b/modules/home/wayland/apps/eww/bar/modules/clock.yuck index d473cdb..02111f6 100644 --- a/modules/home/wayland/apps/eww/bar/modules/clock.yuck +++ b/modules/home/wayland/apps/eww/bar/modules/clock.yuck @@ -14,21 +14,21 @@ :orientation "v" (label :show-truncated false :class "hour" - :text {hour}) + :text {time.hour}) (label :show-truncated false :class "minute" - :text {minute})) + :text {time.minute})) (revealer :reveal date_rev (box :class "date" :orientation "v" - (label :show-truncated "false" - :class "day" - :text {day}) (label :show-truncated "false" - :class "month" - :text {month})) + :class "day" + :text {time.day}) + (label :show-truncated "false" + :class "month" + :text {time.month})) ) ) ) @@ -36,7 +36,5 @@ ) ) -(defpoll hour :interval "15s" "date '+%H'") -(defpoll minute :interval "15s" "date '+%M'") -(defpoll day :interval "15s" "date '+%d'") -(defpoll month :interval "15s" "date '+%m'") +(defpoll time :interval "15s" "date '+{\"hour\":\"%H\",\"minute\":\"%M\",\"day\":\"%d\",\"month\":\"%m\"}'") + diff --git a/modules/home/wayland/apps/eww/bar/scripts/brightness b/modules/home/wayland/apps/eww/bar/scripts/brightness index 995994f..70bd652 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/brightness +++ b/modules/home/wayland/apps/eww/bar/scripts/brightness @@ -22,7 +22,8 @@ case "$1" in *) gen_output [ -z "$DEV" ] && exit 0 - # Poll for changes every 2s (sysfs files don't support inotify reliably) - while true; do sleep 2; gen_output; done + udevadm monitor --udev --subsystem-match=backlight 2>/dev/null | while read -r _; do + gen_output + done ;; esac diff --git a/modules/home/wayland/apps/eww/bar/scripts/net/bluetooth b/modules/home/wayland/apps/eww/bar/scripts/net/bluetooth index 8483bd3..b562c72 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/net/bluetooth +++ b/modules/home/wayland/apps/eww/bar/scripts/net/bluetooth @@ -27,8 +27,8 @@ pipe="$tmp/bt-events" mkfifo "$pipe" trap 'rm -rf "$tmp"; kill 0 2>/dev/null' EXIT INT TERM -# Poll every 2s as reliable fallback for missed events -(while true; do sleep 2; echo poll; done) > "$pipe" & +# Poll every 10s as reliable fallback for missed events +(while true; do sleep 10; echo poll; done) > "$pipe" & # bluetoothctl monitor for reactive device connect/disconnect events (bluetoothctl monitor 2>/dev/null | grep --line-buffered -E "Powered|Connected|Device") > "$pipe" & diff --git a/modules/home/wayland/apps/eww/bar/scripts/net/bt-devices b/modules/home/wayland/apps/eww/bar/scripts/net/bt-devices index b209ddd..dfe7853 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/net/bt-devices +++ b/modules/home/wayland/apps/eww/bar/scripts/net/bt-devices @@ -22,8 +22,8 @@ pipe="$tmp/bt-dev-events" mkfifo "$pipe" trap 'rm -rf "$tmp"; kill 0 2>/dev/null' EXIT INT TERM -# Poll every 3s as fallback for missed events -(while true; do sleep 3; echo poll; done) > "$pipe" & +# Poll every 10s as fallback for missed events +(while true; do sleep 10; echo poll; done) > "$pipe" & # Reactive updates from D-Bus (bluetoothctl monitor 2>/dev/null | grep --line-buffered -E "Connected|Device|Powered") > "$pipe" & diff --git a/modules/home/wayland/apps/eww/bar/scripts/power-save b/modules/home/wayland/apps/eww/bar/scripts/power-save index 2fa337d..ed0d189 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/power-save +++ b/modules/home/wayland/apps/eww/bar/scripts/power-save @@ -1,9 +1,15 @@ #!/usr/bin/env bash -current=$(eww state 2>/dev/null | grep '^power-save:' | awk '{print $2}') -if [ "$current" = "true" ]; then - powerprofilesctl set balanced 2>/dev/null || true - echo false -else - powerprofilesctl set power-saver 2>/dev/null || true - echo true -fi +case "$1" in + status) + powerprofilesctl get | grep -q power-saver && echo true || echo false + ;; + *) + if powerprofilesctl get | grep -q power-saver; then + powerprofilesctl set balanced 2>/dev/null || true + echo false + else + powerprofilesctl set power-saver 2>/dev/null || true + echo true + fi + ;; +esac diff --git a/modules/home/wayland/apps/eww/bar/scripts/volume b/modules/home/wayland/apps/eww/bar/scripts/volume index 3e52f06..ad3f054 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/volume +++ b/modules/home/wayland/apps/eww/bar/scripts/volume @@ -33,8 +33,8 @@ case "$1" in mkfifo "$pipe" trap 'rm -rf "$tmp"; kill 0 2>/dev/null' EXIT INT TERM - # 1s polling fallback - (while true; do sleep 1; echo poll; done) > "$pipe" & + # 2s polling fallback + (while true; do sleep 2; echo poll; done) > "$pipe" & # PipeWire property-change events (fires on mute/volume change) (pw-cli -m 2>/dev/null | grep --line-buffered "changed") > "$pipe" & diff --git a/modules/home/wayland/apps/eww/bar/windows/clock.yuck b/modules/home/wayland/apps/eww/bar/windows/clock.yuck index c6d0e7e..d621741 100644 --- a/modules/home/wayland/apps/eww/bar/windows/clock.yuck +++ b/modules/home/wayland/apps/eww/bar/windows/clock.yuck @@ -69,8 +69,8 @@ ; --- Quick Actions --- -(defvar power-save false) -(defvar night-light false) +(defpoll power-save :interval "5s" :initial "false" "scripts/power-save status") +(defpoll night-light :interval "5s" :initial "false" "scripts/nightlight status") (defwidget quick-btn [icon label onclick active] (button :class "quick-btn ${active ? 'quick-btn-active' : ''}" @@ -85,8 +85,8 @@ (box :orientation "v" :space-evenly false :class "quick-grid" :spacing 4 (box :orientation "h" :space-evenly true (quick-btn :icon "󰸉" :label "Wallpaper" :onclick "scripts/wallpaper" :active false) - (quick-btn :icon "󱐋" :label "Power Save" :onclick "eww update power-save=$(scripts/power-save)" :active {power-save}) - (quick-btn :icon "󰌵" :label "Night Light" :onclick "eww update night-light=$(scripts/nightlight)" :active {night-light})) + (quick-btn :icon "󱐋" :label "Power Save" :onclick "scripts/power-save" :active {power-save}) + (quick-btn :icon "󰌵" :label "Night Light" :onclick "scripts/nightlight" :active {night-light})) (box :orientation "h" :space-evenly true (quick-btn :icon "󰹑" :label "Screenshot" :onclick "scripts/screenshot" :active false) (quick-btn :icon "󰌾" :label "Lock" :onclick "scripts/lock" :active false) diff --git a/modules/home/wayland/apps/eww/bar/windows/sys.yuck b/modules/home/wayland/apps/eww/bar/windows/sys.yuck index 1e580c1..5684c43 100644 --- a/modules/home/wayland/apps/eww/bar/windows/sys.yuck +++ b/modules/home/wayland/apps/eww/bar/windows/sys.yuck @@ -1,11 +1,11 @@ -(defpoll swap :interval "5s" "scripts/sys/swap") +(defpoll swap :interval "30s" "scripts/sys/swap") (defpoll cpu-freq-min :interval "60s" "awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq") (defpoll cpu-freq-max :interval "60s" "awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq") -(defpoll cpu-temp :interval "2s" +(defpoll cpu-temp :interval "4s" "scripts/sys/cputemp") (defpoll cpu-freq-avg :interval "2s" "awk '{sum+=$1; count++} END {printf \"%.1f\", sum/count/1000000}' /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq")