improve eww

This commit is contained in:
2026-09-10 19:54:50 +02:00
parent e551d36e1c
commit 7bb27f9373
46 changed files with 1296 additions and 1092 deletions
@@ -1,17 +1,15 @@
(defpoll swap :interval "30s" "scripts/sys/swap")
(defpoll cpu-freq-min :interval "60s"
(defpoll cpu-freq-min :interval "60s" :initial "0"
"awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq")
(defpoll cpu-freq-max :interval "60s"
(defpoll cpu-freq-max :interval "60s" :initial "1"
"awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq")
(defpoll cpu-temp :interval "4s"
(defpoll cpu-temp :interval "4s" :initial "0"
"scripts/sys/cputemp")
(defpoll cpu-freq-avg :interval "2s"
(defpoll cpu-freq-avg :interval "2s" :initial "0"
"awk '{sum+=$1; count++} END {printf \"%.1f\", sum/count/1000000}' /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq")
(deflisten cpu-grid :initial '[[{"core":0,"usage":0,"freq":0}]]'
"bash scripts/sys/cpugrid")
; The CPU grid is fed by the EWW_CPU magic variable (2 s); jq() reshapes the
; core list into rows of four.
; --- Shared ---
@@ -46,7 +44,7 @@
(box :orientation "v" :space-evenly false :class "sys-section"
(section-header :title "CPU" :accent "cpu-accent")
(box :orientation "v" :space-evenly false :halign "center"
(for row in {cpu-grid}
(for row in {jq(EWW_CPU.cores, '[.[] | .core |= ltrimstr("cpu")] | [range(0; length; 4) as $i | .[$i:$i + 4]]')}
(box :orientation "h" :space-evenly false
(for core in {row}
(cpu-core-cell :core {core})))))
@@ -162,13 +160,13 @@
(overlay
(circular-progress
:width 72 :height 72
:value {100*swap.used/swap.total}
:value {memory.swap.total > 0 ? 100 * memory.swap.used / memory.swap.total : 0}
:start-at 0 :clockwise true :thickness 7
:class "swap-ring"
:tooltip "Swap\n${swap.human.used} / ${swap.human.total}")
:tooltip "Swap\n${memory.swap.human.used} / ${memory.swap.human.total}")
(box :orientation "v" :valign "center" :halign "center" :space-evenly false
(label :class "ram-used-label" :text "${swap.human.used}")
(label :class "ram-total-label" :text "${swap.human.total}"))))
(label :class "ram-used-label" :text "${memory.swap.human.used}")
(label :class "ram-total-label" :text "${memory.swap.human.total}"))))
)
)
)
@@ -185,8 +183,7 @@
:start-at 0
:clockwise true
:thickness 6
:class "bat-ring"
:style "color: ${battery.color};"
:class "bat-ring bat-${battery.state}"
:tooltip "Battery ${round(battery.percentage, 0)}%\n${battery.status} @ ${battery.wattage}")
(label :class "bat-ring-label"
:text "${round(battery.percentage, 0)}%"))