; https://github.com/elkowar/eww/blob/master/examples/eww-bar/ (defwidget bar [] (centerbox :orientation "h" (workspaces) (time) (sidestuff))) (defwidget sidestuff [] (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" (metric :label " " :tooltip "${volume}% volume" :value {volume} :onchange "wpctl set-volume @DEFAULT_SINK@ {}%") (metric :label "󰍛" :tooltip "${round(EWW_RAM.used_mem_perc, 0)}% of RAM used" :value {EWW_RAM.used_mem_perc} :onchange "") (metric :label "󰻠" :tooltip "${round(EWW_CPU.avg, 0)}% average CPU usage" :value {round((EWW_CPU.avg), 0)} :onchange ""))) (defwidget workspaces [] (box :class "workspaces" :orientation "h" :space-evenly true :halign "start" :spacing 10 (button :onclick "riverctl set-focused-tags 1" 1) (button :onclick "riverctl set-focused-tags 2" 2) (button :onclick "riverctl set-focused-tags 4" 3) (button :onclick "riverctl set-focused-tags 8" 4) (button :onclick "riverctl set-focused-tags 16" 5) (button :onclick "riverctl set-focused-tags 32" 6) (button :onclick "riverctl set-focused-tags 64" 7) (button :onclick "riverctl set-focused-tags 128" 8) (button :onclick "riverctl set-focused-tags 256" 9))) (defwidget metric [?tooltip label value onchange] (box :orientation "h" :tooltip tooltip :class "metric" :space-evenly false (box :class "label" label) (scale :min 0 :max 101 :active {onchange != ""} :value value :onchange onchange))) (defpoll volume :interval "1s" "wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{print 100 * $2}'") (defwidget time [] (label :text time-poll)) (defpoll time-poll :interval "10s" "date '+%H:%M %b %d, %Y'") (defwindow bar :monitor 0 :exclusive true :focusable "none" :geometry (geometry :x "0%" :y "0%" :width "100%" :height "10px" :anchor "top center") :reserve (struts :side "top" :distance "4%") (bar))