1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
(defwidget revealer-on-hover [var varname ?class ?duration ?transition]
(box :class "${class} revealer-on-hover"
:orientation "h"
:space-evenly false
(eventbox :class "eventbox"
:onhover "eww update ${varname}=true"
:onhoverlost "eww update ${varname}=false"
(box :space-evenly false
(revealer :reveal var
:transition {transition ?: "slideright"}
:duration {duration ?: "500ms"}
(children :nth 0))
(children :nth 1)))))
(defwindow applauncher
:monitor 0
:geometry (geometry :x "50%"
:y "50%"
:width "500px"
:height "400px"
:anchor "center center")
:stacking "overlay"
:exclusive false
:focusable true
(box :orientation "v"
:class "applauncher"
(input :onaccept `eww close applauncher`)
))
(defwindow powermenu
:monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "100%"
:anchor "top left")
:stacking "overlay"
:exclusive false
:focusable false
(box :orientation "v"
:class "powermenu"
(box :orientation "h"
:class "powermenu-buttons"
:spacing "20"
(box :orientation "v" :space-evenly false
(button :vexpand "true" "")
(label :text "Power Off"))
(box :orientation "v" :space-evenly false
(button :vexpand "true" "")
(label :text "Reboot"))
(box :orientation "v" :space-evenly false
(button :vexpand "true" "")
(label :text "Lock"))
(box :orientation "v" :space-evenly false
(button :vexpand "true" "")
(label :text "Sleep"))
(box :orientation "v" :space-evenly false
(button :vexpand "true" "")
(label :text "Log Out"))
(box :orientation "v" :space-evenly false
(button :vexpand "true" :timeout "5000" :onclick `eww close powermenu` "")
(label :text "Cancel")))))
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "8px"
:width "1904px"
:height "32px"
:anchor "top center")
:stacking "fg"
:exclusive true
:focusable false
(bar))
(defwidget bar []
(centerbox :orientation "h"
:class "bar"
(tags)
(title)
(status)))
(deflisten tags_json :initial `[]` `river-bedload -minified -watch tags`)
(deflisten wintitle :initial `[{"title":""}]` `river-bedload -minified -watch title`)
(defwidget tags []
(box :orientation "h"
:halign "start"
:class "tags"
(button :onclick `riverctl set-focused-tags 1`
:class {jq(tags_json, `.[] | select(.id == 1) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 1) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 2`
:class {jq(tags_json, `.[] | select(.id == 2) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 2) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 4`
:class {jq(tags_json, `.[] | select(.id == 3) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 3) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 8`
:class {jq(tags_json, `.[] | select(.id == 4) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 4) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 16`
:class {jq(tags_json, `.[] | select(.id == 5) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 5) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 32`
:class {jq(tags_json, `.[] | select(.id == 6) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 6) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 64`
:class {jq(tags_json, `.[] | select(.id == 7) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 7) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 128`
:class {jq(tags_json, `.[] | select(.id == 8) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 8) | .occupied or .focused`)}
)
(button :onclick `riverctl set-focused-tags 256`
:class {jq(tags_json, `.[] | select(.id == 9) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class}
;:visible {jq(tags_json, `.[] | select(.id == 9) | .occupied or .focused`)}
)))
(defwidget title []
(label :text {wintitle[0].title}
:class "title"
:truncate true
:show-truncated true
:visible {wintitle[0].title != ""}
:limit-width 55))
(deflisten volume :initial "0" `monitor-volume`)
(defpoll ssid :initial "" :interval "10s" `iwctl station wlan0 get-networks | awk -F' ' '/>/{print $3}'`)
(deflisten brightness :initial "0" `brightctl -l`)
(defpoll time :initial "" :interval "1s" `date '+%b %-d %H:%M:%S'`)
(defvar showvol false)
(defwidget status []
(box :orientation "h"
:halign "end"
:class "status"
:spacing 8
:space-evenly false
(revealer-on-hover :var showvol
:varname "showvol"
:icon "a"
:transition "slideleft"
:class "volume"
(scale :orientation "h"
:min 0
:max 1
:value {volume}
:onchange `wpctl set-volume @DEFAULT_SINK@ {}`)
(label :text "${matches(volume, "MUTED") ? " " : volume == 0 ? "" : volume < 50 ? "" : " "} ${volume}%"
:class "volume"))
(label :text "${ssid == "" ? "" : ""} ${ssid}"
:class "network")
(label :text " ${brightness}%"
:class "brightness")
(label :text "${`{"Discharging": ["","","","","","","","","",""], "Charging": ["","","","","","","","","",""]}`?.[EWW_BATTERY.BAT0.status]?.[round((EWW_BATTERY.BAT0.capacity - 1) / 10, 0)] ?: ""} ${EWW_BATTERY.BAT0.capacity}%"
:class "battery")
(label :text " ${time}"
:class "clock")
(label :text ""
:class "menu")))
;(label :text ""
;:class "power")))
|