305 lines
6.3 KiB
Plaintext
305 lines
6.3 KiB
Plaintext
(include "./clock.yuck")
|
|
|
|
(defwindow system-monitor
|
|
:monitor '[ "<secondary>", "DP-2" ]'
|
|
:class "system-monitor"
|
|
:geometry (geometry
|
|
:x "0px"
|
|
:y "36px"
|
|
:width "100%"
|
|
:height "200px"
|
|
:anchor "top center"
|
|
)
|
|
:stacking "fg"
|
|
:exclusive true
|
|
:focusable false
|
|
(system-monitor)
|
|
)
|
|
|
|
(defwidget system-monitor []
|
|
(box
|
|
:orientation "h"
|
|
:spacing 8
|
|
:space-evenly false
|
|
:halign "end"
|
|
:class "system-monitor"
|
|
(box
|
|
:orientation "h"
|
|
:halign "start"
|
|
:space-evenly false
|
|
:spacing 8
|
|
(system-monitor-perf)
|
|
(system-monitor-disks)
|
|
(system-monitor-net)
|
|
)
|
|
(box
|
|
:orientation "h"
|
|
:halign "end"
|
|
:space-evenly false
|
|
:spacing 8
|
|
(system-monitor-audio)
|
|
(clock-large)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-group [name ?orientation]
|
|
(box
|
|
:class "system-monitor-widget"
|
|
:orientation "v"
|
|
:space-evenly false
|
|
(label
|
|
:class "widget-title"
|
|
:text name
|
|
)
|
|
(box
|
|
:orientation {orientation ?: "h"}
|
|
:spacing 8
|
|
:space-evenly false
|
|
(children)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-perf-cpu []
|
|
(box
|
|
:orientation "v"
|
|
(system-monitor-sparkgraph
|
|
:name "CPU"
|
|
:class "system-monitor-sparkgraph-cpu"
|
|
:value {EWW_CPU.avg}
|
|
:units "%"
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "Mem"
|
|
:class "system-monitor-sparkgraph-mem"
|
|
:value {EWW_RAM.used_mem_perc}
|
|
:units "%"
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "Temp"
|
|
:class "system-monitor-sparkgraph-temp"
|
|
:value {EWW_TEMPS["CORETEMP_PACKAGE_ID_0"]}
|
|
:units "°"
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-perf-gpu []
|
|
(box
|
|
:orientation "v"
|
|
(system-monitor-sparkgraph
|
|
:name "GPU"
|
|
:class "system-monitor-sparkgraph-cpu"
|
|
:value {gpu-stats.gpu}
|
|
:units "%"
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "VRAM"
|
|
:class "system-monitor-sparkgraph-mem"
|
|
:value {gpu-stats.memory}
|
|
:units "%"
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "Temp"
|
|
:class "system-monitor-sparkgraph-temp"
|
|
:value {gpu-stats.temp}
|
|
:units "°"
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-perf []
|
|
(system-monitor-group
|
|
:name "Performance"
|
|
:orientation "h"
|
|
(system-monitor-perf-cpu)
|
|
(system-monitor-perf-gpu)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-gauge [name text-value gauge-pct units ?precision]
|
|
(box
|
|
:orientation "v"
|
|
:valign "center"
|
|
:halign "center"
|
|
:class "system-monitor-gauge"
|
|
:width 60
|
|
(label
|
|
:text name
|
|
)
|
|
(circular-progress
|
|
:class "system-monitor-gauge-circle"
|
|
:value {gauge-pct}
|
|
:height 32
|
|
:thickness 5
|
|
)
|
|
(label
|
|
:text "${round(text-value, precision ?: 0)}${units}"
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-disks []
|
|
(system-monitor-group
|
|
:name "Disks"
|
|
(system-monitor-gauge
|
|
:name "Root"
|
|
:text-value {EWW_DISK['/'].free / powi(2, 30)}
|
|
:gauge-pct {EWW_DISK['/'].used_perc}
|
|
:units " GB"
|
|
)
|
|
(system-monitor-gauge
|
|
:name "Home"
|
|
:text-value {EWW_DISK['/home'].free / powi(2, 30)}
|
|
:gauge-pct {EWW_DISK['/home'].used_perc}
|
|
:units " GB"
|
|
)
|
|
)
|
|
)
|
|
|
|
(defpoll network-name
|
|
:interval "1s"
|
|
:initial "Loading..."
|
|
`iwgetid -r`
|
|
)
|
|
|
|
(defwidget system-monitor-net []
|
|
(system-monitor-group
|
|
:name "Network"
|
|
:orientation "v"
|
|
(label
|
|
:class "system-monitor-network-name"
|
|
:text {network-name}
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "Down"
|
|
:value {EWW_NET["wlo1"]["NET_DOWN"] / 1000000}
|
|
:units " MB/s"
|
|
)
|
|
(system-monitor-sparkgraph
|
|
:name "Up"
|
|
:value {EWW_NET["wlo1"]["NET_UP"] / 1000000}
|
|
:units " MB/s"
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-sparkgraph [name value units ?class]
|
|
(box
|
|
:class "system-monitor-sparkgraph ${class ?: ""}"
|
|
:orientation "h"
|
|
:halign "start"
|
|
:space-evenly false
|
|
(box
|
|
:width 40
|
|
:orientation "h"
|
|
:halign "end"
|
|
(label
|
|
:text name
|
|
:valign "end"
|
|
:halign "end"
|
|
)
|
|
)
|
|
(box
|
|
:class "system-monitor-sparkgraph-graph ${ value > 80 ? "danger" : "" }"
|
|
(graph
|
|
:width 80
|
|
:height 30
|
|
:dynamic true
|
|
:value { value ?: 0 }
|
|
:thickness 1
|
|
:time-range "60s"
|
|
)
|
|
)
|
|
(box
|
|
:orientation "h"
|
|
:halign "center"
|
|
:space-evenly false
|
|
(box
|
|
:halign "end"
|
|
:width 30
|
|
(label
|
|
:class "system-monitor-sparkgraph-value"
|
|
:text "${round(value ?: 0, 1)}"
|
|
:valign "end"
|
|
:halign "end"
|
|
)
|
|
)
|
|
(label
|
|
:class "system-monitor-sparkgraph-units"
|
|
:text "${units}"
|
|
:valign "end"
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-audio-slider [name volume muted onchange]
|
|
(box
|
|
:class "system-monitor-audio"
|
|
:orientation "v"
|
|
:valign "start"
|
|
:halign "fill"
|
|
:space-evenly false
|
|
(box
|
|
:width 40
|
|
:orientation "h"
|
|
:class "system-monitor-audio-name"
|
|
(label
|
|
:text {substring(name, 0, 20)}
|
|
)
|
|
)
|
|
(box
|
|
:class "system-monitor-audio-slider ${muted ? "muted" : ""}"
|
|
:width 150
|
|
:orientation "h"
|
|
:halign "fill"
|
|
:space-evenly false
|
|
(image
|
|
:class "system-monitor-audio-icon"
|
|
:icon {
|
|
(muted ?: false) ? "audio-volume-muted" : (
|
|
(volume ?: 0) > 75 ? "audio-volume-high" : (
|
|
(volume ?: 0) > 25 ? "audio-volume-medium" : "audio-volume-low"
|
|
)
|
|
)
|
|
}
|
|
)
|
|
(scale
|
|
:hexpand true
|
|
:value {volume * 100}
|
|
:min 0
|
|
:max 100
|
|
:orientation "h"
|
|
:onchange {onchange ?: ""}
|
|
)
|
|
(label
|
|
:text "${round(volume * 100, 0)}"
|
|
:class "system-monitor-audio-slider-value"
|
|
:halign "end"
|
|
:width 30
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget system-monitor-audio []
|
|
(system-monitor-group
|
|
:name "Audio"
|
|
:orientation "v"
|
|
(system-monitor-audio-slider
|
|
:name {audio-output?.description ?: ""}
|
|
:volume {audio-output?.volume ?: 0}
|
|
:onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"
|
|
:muted {audio-output?.muted ?: true}
|
|
)
|
|
(system-monitor-audio-slider
|
|
:name {audio-input?.description ?: ""}
|
|
:volume {audio-input?.volume ?: 0}
|
|
:onchange "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ {}%"
|
|
:muted {audio-input?.muted ?: true}
|
|
)
|
|
)
|
|
)
|