49 lines
1.4 KiB
Plaintext

(defwidget metrics []
(box :class "system" :orientation "h" :space-evenly false :halign "end"
(_battery)
(metric :label "󰘚"
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "󰋊"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 151
:active {onchange != ""}
:value value
:onchange onchange)))
(defpoll battery-percent :interval "30s"
:initial ''
"./scripts/battery-percent")
(defpoll battery-status :interval "5s"
:initial ''
"./scripts/battery-status")
(defwidget _battery []
(box :class "bat-box" :space-evenly false :spacing 8
:visable {battery-status != ''}
(label :text {battery-status == 'Charging' ? "󰂄" :
battery-percent < 10 ? "󰂃" :
battery-percent < 20 ? "󰁻" :
battery-percent < 30 ? "󰁼" :
battery-percent < 40 ? "󰁽" :
battery-percent < 50 ? "󰁾" :
battery-percent < 60 ? "󰁿" :
battery-percent < 70 ? "󰂀" :
battery-percent < 80 ? "󰂁" :
battery-percent < 90 ? "󰂂" : "󰁹"})))
(defpoll time :interval "1s"
"date '+%H:%M'")