dotfiles/de/home/.config/eww/eww.yuck
2025-03-03 18:30:59 -08:00

73 lines
1.8 KiB
Text

(defwidget bar []
(centerbox :orientation "h"
(workspaces :array workspacesArray)
(music)
(sidestuff)))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(metric :label "🔊"
:value volume
:onchange "amixer -D pulse 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))
(deflisten workspacesArray :initial "${[1]}"
`~/.config/eww/scripts/getWorkspaces.sh`)
(defwidget workspaces [array]
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
(for entry in array
(button :onclick `swaymsg workspace "${entry.name}"`
:class {entry.focused ? "focused" : ""}
`${entry.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 volume :interval "1s"
"scripts/getvol")
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
(defwindow bar
:monitor 0
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "99%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))