eww/examples/eww-bar/eww.yuck

76 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2021-07-26 23:41:20 +03:00
(defwidget bar []
2021-08-17 13:02:29 +03:00
(centerbox :orientation "h"
(workspaces)
(music)
(sidestuff)))
2021-07-26 23:41:20 +03:00
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
2021-08-18 17:21:04 +03:00
(metric :label "🔊"
:value volume
:onchange "amixer -D pulse sset Master {}%")
(metric :label ""
2021-09-12 13:03:10 +03:00
:value {EWW_RAM.used_mem_perc}
2021-08-18 17:21:04 +03:00
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
2021-08-17 13:02:29 +03:00
time))
2021-07-26 23:41:20 +03:00
(defwidget workspaces []
2021-07-31 18:45:59 +03:00
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
2021-08-17 13:02:29 +03:00
:spacing 10
(button :onclick "wmctrl -s 0" 1)
(button :onclick "wmctrl -s 1" 2)
(button :onclick "wmctrl -s 2" 3)
(button :onclick "wmctrl -s 3" 4)
(button :onclick "wmctrl -s 4" 5)
(button :onclick "wmctrl -s 5" 6)
(button :onclick "wmctrl -s 6" 7)
(button :onclick "wmctrl -s 7" 8)
(button :onclick "wmctrl -s 8" 9)))
2021-07-26 23:41:20 +03:00
(defwidget music []
2021-08-18 17:21:04 +03:00
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
2021-08-18 17:30:11 +03:00
{music != "" ? "🎵${music}" : ""}))
2021-07-26 23:41:20 +03:00
2021-08-18 17:21:04 +03:00
(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)))
2021-07-26 23:41:20 +03:00
2021-07-31 18:45:59 +03:00
2021-07-26 23:41:20 +03:00
2021-08-18 17:30:11 +03:00
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
2021-07-31 18:45:59 +03:00
2021-08-18 17:21:04 +03:00
(defpoll volume :interval "1s"
"scripts/getvol")
2021-07-26 23:41:20 +03:00
2021-08-18 17:21:04 +03:00
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
2021-07-26 23:41:20 +03:00
(defwindow bar
2021-07-28 21:20:41 +03:00
:monitor 0
:windowtype "dock"
2021-08-18 17:30:11 +03:00
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))