dotfiles/eww/eww.yuck

87 lines
2.3 KiB
Text
Raw Normal View History

(defpoll volume :interval "1s" "scripts/getvol")
(defwidget bar [index]
(centerbox :orientation "h"
(workspaces :index index)
(music)
(sidestuff)))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(metric :label "∰"
:value volume
:onchange "amixer sset Master {}%")
(metric :label "🐏"
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time))
(defwidget workspaces [index]
(box :class "workspaces"
:orientation "h"
:space-evenly false
:halign "start"
:spacing 10
(box
(for tag in '${wmstate.workspaces[index].tags}'
(button
:class {tag.mine ? "ws-button-mine" :
tag.visible ? "ws-button-visible" :
tag.urgent ? "ws-button-urgent" :
tag.busy ? "ws-button-busy" :
"ws-button"
}
:onclick "leftwm-command \"SendWorkspaceToTag ${index} ${tag.index}\""
{!tag.mine && !tag.busy && !tag.visible && !tag.urgent ? "." : "${tag.name}"}
)
)
)
)
)
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{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 '{{ artist }} - {{ title }}' || true")
(defpoll time :interval "1s"
"date '+%H:%M:%S %b %d, %Y'")
(deflisten wmstate
:initial '{"workspaces":[{"layout":"","tags":[{"name":"","index":0,"mine":false,"busy":false,"visible":false,"urgent":false}]}]}'
"leftwm state"
)
(defwindow bar [index]
:monitor index
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "8px"
:anchor "top center")
:reserve (struts :side "top" :distance "30px")
:exclusive true
(bar :index index)
)