blob: a4a27d2cb80bb6d0ed0c7bcc2dbae34869c854e6 [file] [log] [blame]
Samuel Shuert504b0fd2024-02-11 14:39:15 -05001(defwidget bar []
2 (centerbox :orientation "h"
3 (workspaces)
4 (music)
5 (sidestuff)))
Samuel Shuert3f828662024-02-10 20:45:50 -05006
Samuel Shuert504b0fd2024-02-11 14:39:15 -05007(defwidget sidestuff []
8 (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
9 (metric :label "🔊"
10 :value volume
11 :onchange "amixer -D pulse sset Master {}%")
12 (metric :label "ï¡š"
13 :value {EWW_RAM.used_mem_perc}
14 :onchange "")
15 (metric :label "💾"
16 :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
17 :onchange "")
18 time))
Samuel Shuert3f828662024-02-10 20:45:50 -050019
20(defwidget workspaces []
Samuel Shuert504b0fd2024-02-11 14:39:15 -050021 (box :class "workspaces"
Samuel Shuert3f828662024-02-10 20:45:50 -050022 :orientation "h"
Samuel Shuert504b0fd2024-02-11 14:39:15 -050023 :space-evenly true
24 :halign "start"
25 :spacing 10
26 (button :onclick "wmctrl -s 0" 1)
27 (button :onclick "wmctrl -s 1" 2)
28 (button :onclick "wmctrl -s 2" 3)
29 (button :onclick "wmctrl -s 3" 4)
30 (button :onclick "wmctrl -s 4" 5)
31 (button :onclick "wmctrl -s 5" 6)
32 (button :onclick "wmctrl -s 6" 7)
33 (button :onclick "wmctrl -s 7" 8)
34 (button :onclick "wmctrl -s 8" 9)))
35
36(defwidget music []
37 (box :class "music"
38 :orientation "h"
39 :space-evenly false
40 :halign "center"
41 {music != "" ? "🎵${music}" : ""}))
42
43
44(defwidget metric [label value onchange]
45 (box :orientation "h"
46 :class "metric"
47 :space-evenly false
48 (box :class "label" label)
49 (scale :min 0
50 :max 101
51 :active {onchange != ""}
52 :value value
53 :onchange onchange)))
54
55
56
57(deflisten music :initial ""
58 "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
59
60(defpoll volume :interval "1s"
61 "scripts/getvol")
62
63(defpoll time :interval "10s"
64 "date '+%H:%M %b %d, %Y'")
Samuel Shuert3f828662024-02-10 20:45:50 -050065
66(defwindow bar
Samuel Shuert504b0fd2024-02-11 14:39:15 -050067 :monitor 0
68 :windowtype "dock"
69 :geometry (geometry :x "0%"
70 :y "0%"
71 :width "90%"
72 :height "10px"
73 :anchor "top center")
74 :reserve (struts :side "top" :distance "4%")
75 (bar))