95 lines
2.7 KiB
Plaintext
95 lines
2.7 KiB
Plaintext
(defwidget bar []
|
|
(centerbox :orientation "h"
|
|
(workspaces)
|
|
(middle)
|
|
(sidestuff)))
|
|
|
|
(defwidget middle []
|
|
(box :orientation "h" :space-evenly false
|
|
(icon)
|
|
(music)))
|
|
|
|
(defwidget sidestuff []
|
|
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
|
|
(metric :label ""
|
|
:value '${EWW_CPU.avg}'
|
|
:onchange "")
|
|
(metric :label ""
|
|
:value '${EWW_RAM.used_mem_perc}'
|
|
:onchange "")
|
|
(metric :label ""
|
|
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
|
|
:onchange "")
|
|
(time)))
|
|
|
|
; eww is natively able to parse the JSON output of `leftwm-state`
|
|
; since eww also has the ability of `for` loops there is no need for a `liquid` template anymore
|
|
(defwidget workspaces []
|
|
(box :class "workspaces"
|
|
:orientation "h"
|
|
:space-evenly true
|
|
:halign "start"
|
|
:spacing 5
|
|
(box
|
|
(for tag in '${wmstate.workspaces[0].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 0 ${tag.index}\""
|
|
{!tag.mine && !tag.busy && !tag.visible && !tag.urgent ? "" : ""})))))
|
|
|
|
(defwidget music []
|
|
(box :class "music"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
{music != "" ? "${music}"[:50] : ""}))
|
|
|
|
(defwidget icon []
|
|
(box :class "spotify"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
{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)))
|
|
|
|
(defwidget time []
|
|
(box :class "time" {time}))
|
|
|
|
|
|
(deflisten music :initial ""
|
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
|
|
|
|
(defpoll volume :interval "1s" :initial "50"
|
|
"scripts/getvol")
|
|
|
|
(defpoll time :interval "10s"
|
|
"date '+%H:%M - %d %b, %Y'")
|
|
|
|
(deflisten wmstate
|
|
:initial '{"workspaces":[{"layout":"","tags":[{"name":"","index":0,"mine":false,"busy":false,"visible":false,"urgent":false}]}]}'
|
|
"leftwm state")
|
|
|
|
(defwindow bar0
|
|
:monitor 1
|
|
:windowtype "dock"
|
|
:geometry (geometry :x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "30px"
|
|
:anchor "top left")
|
|
:reserve (struts :side "top" :distance "5%")
|
|
(bar))
|