64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
|
(defwidget bar []
|
||
|
(centerbox :orientation "h"
|
||
|
(sidestuff)
|
||
|
(box)
|
||
|
(music)
|
||
|
)
|
||
|
)
|
||
|
|
||
|
(defwidget sidestuff []
|
||
|
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 10
|
||
|
time
|
||
|
; TODO: get these to align properly
|
||
|
(metric :label " "
|
||
|
:value volume
|
||
|
:onchange "pamixer --set-volume {}%")
|
||
|
(metric :label " "
|
||
|
:value {EWW_RAM.used_mem_perc}
|
||
|
:onchange "")
|
||
|
(metric :label ""
|
||
|
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
|
||
|
:onchange "")
|
||
|
))
|
||
|
|
||
|
(defwidget music []
|
||
|
(box :class "music"
|
||
|
:orientation "h"
|
||
|
:halign "end"
|
||
|
:space-evenly false
|
||
|
{music != "" ? "${music}" : ""}))
|
||
|
|
||
|
|
||
|
(defwidget metric [label value onchange]
|
||
|
(box :orientation "h"
|
||
|
:class "metric"
|
||
|
:space-evenly false
|
||
|
(box :class "label" label)
|
||
|
(scale :min 0
|
||
|
:max 101
|
||
|
:active {onchange != ""}
|
||
|
:value value
|
||
|
:onchange onchange)))
|
||
|
|
||
|
|
||
|
|
||
|
(deflisten music :initial ""
|
||
|
"playerctl --follow metadata --format '{{ title }} by {{ artist }}' || true")
|
||
|
|
||
|
(defpoll volume :interval "1s"
|
||
|
"pamixer --get-volume")
|
||
|
|
||
|
(defpoll time :interval "10s"
|
||
|
"date '+%a %b %d %H:%M:%S'")
|
||
|
|
||
|
(defwindow bar
|
||
|
:monitor 2
|
||
|
:stacking "fg"
|
||
|
:exclusive true
|
||
|
:geometry (geometry :x "0%"
|
||
|
:y "0%"
|
||
|
:width "100%"
|
||
|
:height "31px"
|
||
|
:anchor "bottom center")
|
||
|
(bar))
|