|
13 | 13 | :geometry (geometry :anchor "top center" :x "0%" :y "0" :width "100%" :height "20px") |
14 | 14 | (bar :screen 1)) |
15 | 15 |
|
16 | | -(defwindow tray-window0 |
| 16 | +(defwindow calendar |
17 | 17 | :monitor 0 |
| 18 | + :exclusive false |
| 19 | + :focusable true |
18 | 20 | :stacking "fg" |
19 | | - :focusable false |
20 | | - :windowtype "dock" |
21 | | - :geometry (geometry :anchor "top right" :x "0" :y "4px" :width "40px" :height "100px") |
22 | | - (tray)) |
| 21 | + :geometry (geometry :anchor "top right" :x "140px" :y "2px") |
| 22 | + (calendar-widget)) |
23 | 23 |
|
24 | | -(defwindow tray-window1 |
25 | | - :monitor 1 |
26 | | - :stacking "fg" |
27 | | - :focusable false |
28 | | - :windowtype "dock" |
29 | | - :geometry (geometry :anchor "top right" :x "0" :y "4px" :width "40px" :height "100px") |
30 | | - (tray)) |
31 | 24 | ; foldend |
32 | 25 |
|
33 | 26 | ; Bar foldstart |
|
50 | 43 | ; (noisetorch) |
51 | 44 | (microphone) |
52 | 45 | (speaker) |
53 | | - (ping) |
| 46 | + ; (ping) |
54 | 47 | (network) |
55 | 48 | (disk) |
56 | 49 | (ram) |
|
59 | 52 | (battery) |
60 | 53 | (date) |
61 | 54 | (time) |
62 | | - (box :visible {screen == 0} (tray_button0)) |
63 | | - (box :visible {screen == 1} (tray_button1))))) |
| 55 | + (box :visible {screen == 0} (systray :class "tray-item" :orientation "h" :icon-size 16 :spacing 3)) |
| 56 | + (box :visible {screen == 1} (systray :class "tray-item" :orientation "h" :icon-size 16 :spacing 3))))) |
64 | 57 | ; foldend |
65 | 58 |
|
66 | 59 | ; Variables foldstart |
67 | 60 | (defpoll time_poll :interval "1s" "date +%H:%M") |
68 | 61 | (defpoll date_poll :interval "1m" "date +%d/%m/%Y") |
| 62 | +(defpoll calendar_poll :interval "1h" "cal") |
69 | 63 | (defpoll trash_poll :interval "10s" "./modules/trash.sh") |
70 | 64 | (defpoll noisetorch_poll :initial "" :interval "10s" "./modules/noisetorch.sh") |
71 | 65 | (defpoll updates_poll :initial "" :interval "1m" "./modules/updates.sh &") |
|
77 | 71 | (deflisten nvidia_listen "./modules/nvidia.sh") |
78 | 72 | (deflisten notifications_listen :initial '{"show": "no", "content": ""}' "./modules/notifications.sh") |
79 | 73 |
|
80 | | -; Make this cleaner at some point |
81 | | -(defpoll microphone_poll :interval "999h" "./modules/microphone.sh") |
82 | | -(defpoll speaker_poll :interval "999h" "./modules/speaker.sh") |
| 74 | +; Audio listeners for real-time updates across all monitors |
| 75 | +(deflisten speaker_listen :initial "{\"content\": \"--\", \"icon\": \"\"}" "./modules/speaker-listen.sh") |
| 76 | +(deflisten microphone_listen :initial "{\"content\": \"--\", \"icon\": \"\"}" "./modules/microphone-listen.sh") |
| 77 | + |
| 78 | +; Get active network interface dynamically |
| 79 | +(defpoll active_interface :interval "60s" :initial "tun0" "./scripts/network-interface.sh") |
83 | 80 |
|
84 | | -; Tray variables |
85 | | -(defvar open_tray true) |
86 | | -(defvar tray0_active false) |
87 | | -(defvar tray1_active false) |
88 | 81 | ; foldend |
89 | 82 |
|
90 | 83 | ; Modules foldstart |
|
109 | 102 |
|
110 | 103 | (defwidget ram [] |
111 | 104 | (icon-module :class "ram" :icon " " :visible {EWW_RAM.used_mem_perc != ""} |
112 | | - (label :text "${round(EWW_RAM.used_mem_perc, 0)}%"))) |
| 105 | + (button :onclick "foot btop" |
| 106 | + (label :text "${round(EWW_RAM.used_mem_perc, 0)}%")))) |
113 | 107 |
|
114 | 108 | (defwidget notifications [] |
115 | 109 | (icon-module :class "notifications" :icon "" :visible {notifications_listen.show == "yes"} |
116 | 110 | (literal :content {notifications_listen.content}))) |
117 | 111 |
|
118 | 112 | (defwidget date [] |
119 | 113 | (icon-module :class "date" :icon "" |
120 | | - (eventbox :onhover "cal" |
| 114 | + (eventbox :onhover "cal" :onrightclick "eww close calendar 2>/dev/null || eww open calendar" |
121 | 115 | (label :text date_poll)))) |
122 | 116 |
|
123 | 117 | (defwidget time [] |
|
130 | 124 |
|
131 | 125 | (defwidget cpu [] |
132 | 126 | (icon-module :class "cpu" :icon " " |
133 | | - (button :onclick "kitty btop" |
| 127 | + (button :onclick "foot btop" |
134 | 128 | (label :text "${round(EWW_CPU.avg, 0)}%")))) |
135 | 129 |
|
136 | 130 | (defwidget disk [] |
137 | 131 | (icon-module :class "disk" :icon "" |
138 | | - (label :text "${round(EWW_DISK["/"].used_perc, 0)}%"))) |
| 132 | + (button :onclick "foot btop" |
| 133 | + (label :text "${round(EWW_DISK["/"].used_perc, 0)}%")))) |
139 | 134 |
|
140 | 135 | (defwidget trash [] |
141 | 136 | (icon-module :class "trash" :icon "" |
|
159 | 154 | (label :text ping_poll))) |
160 | 155 |
|
161 | 156 | (defwidget battery [] |
162 | | - (icon-module :class "battery" :icon "" |
| 157 | + (icon-module :class "battery" :icon "${EWW_BATTERY.BAT0.status == 'Charging' ? '' : EWW_BATTERY.BAT0.capacity >= 75 ? '' : EWW_BATTERY.BAT0.capacity >= 50 ? '' : EWW_BATTERY.BAT0.capacity >= 25 ? '' : EWW_BATTERY.BAT0.capacity >= 10 ? '' : ''}" |
163 | 158 | (label :text "${EWW_BATTERY.BAT0.capacity}%"))) |
164 | 159 |
|
165 | 160 | (defwidget network [] |
166 | 161 | (icon-module :class "network" :icon "" |
167 | | - (label :text "${round(EWW_NET.enp42s0.NET_UP / 1000000, 2)}/${round(EWW_NET.enp42s0.NET_DOWN / 1000000, 2)}"))) |
| 162 | + (button :onclick "foot btop" |
| 163 | + (label :text "${round(EWW_NET[active_interface].NET_UP / 1000000, 2)}/${round(EWW_NET[active_interface].NET_DOWN / 1000000, 2)}")))) |
168 | 164 |
|
169 | 165 | (defwidget speaker [] |
170 | 166 | (icon-module :class "speaker" |
171 | | - :icon {speaker_poll.icon} |
172 | | - (eventbox :onscroll `eww update speaker_poll="$(./modules/speaker.sh {})"` |
173 | | - (button :onclick `eww update speaker_poll="$(./modules/speaker.sh toogle)"` |
174 | | - (label :text {speaker_poll.content}))))) |
| 167 | + :icon {speaker_listen.icon} |
| 168 | + (eventbox :onscroll `./modules/speaker.sh {}` |
| 169 | + (button :onclick `./modules/speaker.sh toogle` |
| 170 | + (label :text {speaker_listen.content}))))) |
175 | 171 |
|
176 | 172 | (defwidget microphone [] |
177 | 173 | (icon-module :class "microphone" |
178 | | - :icon {microphone_poll.icon} |
179 | | - (eventbox :onscroll `eww update microphone_poll="$(./modules/microphone.sh {})"` |
180 | | - (button :onclick `eww update microphone_poll="$(./modules/microphone.sh toogle)"` |
181 | | - (label :text {microphone_poll.content}))))) |
| 174 | + :icon {microphone_listen.icon} |
| 175 | + (eventbox :onscroll `./modules/microphone.sh {}` |
| 176 | + (button :onclick `./modules/microphone.sh toogle` |
| 177 | + (label :text {microphone_listen.content}))))) |
| 178 | + |
| 179 | +; Calendar popup widget |
| 180 | +(defwidget calendar-widget [] |
| 181 | + (eventbox :onclick "eww close calendar" |
| 182 | + (label :text calendar_poll |
| 183 | + :class "calendar-text"))) |
182 | 184 |
|
183 | | -; Include tray module |
184 | | -(include "modules/tray.yuck") |
185 | 185 | ; foldend |
186 | 186 |
|
187 | 187 | ; vim:foldmarker=foldstart,foldend |
0 commit comments