61 lines
2.0 KiB
Common Lisp
61 lines
2.0 KiB
Common Lisp
;; -*-lisp-*-
|
|
(deflisten system--data :initial "{}"
|
|
`~/.config/eww/scripts/system.py`)
|
|
|
|
(defwidget system-battery [battery]
|
|
(box :orientation "v"
|
|
:halign "start"
|
|
:class "module text"
|
|
:space-evenly false
|
|
:spacing 0
|
|
(label :class {EWW_BATTERY[battery].status == 'Charging' || EWW_BATTERY[battery].status == 'Full' ? 'green' : EWW_BATTERY[battery].capacity <= 25 ? 'highlight' : 'special'}
|
|
:text "${EWW_BATTERY[battery].capacity}%")
|
|
(label :text "${EWW_BATTERY[battery].status == 'Charging' || EWW_BATTERY[battery].status == 'Full' ? 'external' : 'internal'} power")))
|
|
|
|
(defwidget system-name []
|
|
(label :halign "center"
|
|
:valign "center"
|
|
:class "module text big nebula"
|
|
:text {system--data.hostname}))
|
|
|
|
(defwidget system-cpu-avg []
|
|
(box :orientation "v"
|
|
:halign "start"
|
|
:class "module text"
|
|
:space-evenly false
|
|
:spacing 0
|
|
(label :class {system--data.cpu.avg > 90 ? 'highlight' : 'special'}
|
|
:text "${system--data.cpu.avg_display}%")
|
|
(label :text "cpu utilization")))
|
|
|
|
(defwidget system--cpu-core [core]
|
|
(label :class {core.value > 90 ? "highlight" : "special"}
|
|
:text "${core.display}%"))
|
|
|
|
(defwidget system-cpu-percore []
|
|
(box :orientation "v"
|
|
:halign "start"
|
|
:class "module text"
|
|
:space-evenly false
|
|
;; (box :orientation "h"
|
|
;; :halign "center"
|
|
;; :space-evenly false
|
|
;; (for core in {system--data.cpu.cores}
|
|
;; (system--cpu-core :core core)))
|
|
(label :class "special"
|
|
:text {system--data.cpu.cores_display})
|
|
(label :text "per-core cpu utilization")
|
|
))
|
|
|
|
(defwidget system-memory []
|
|
(box :orientation "v"
|
|
:halign "start"
|
|
:class "module text"
|
|
:space-evenly false
|
|
(label :class {system--data.memory.percent > 85 ? "highlight" : "special"}
|
|
:text "${round(system--data.memory.used / 1024 / 1024 / 1024, 2)} / ${round(system--data.memory.total / 1024 / 1024 / 1024, 2)} GiB")
|
|
(label :text "system memory")))
|
|
|
|
|
|
|