diff options
author | Minijackson <minijackson@riseup.net> | 2021-04-18 16:58:23 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2021-04-18 16:58:23 +0200 |
commit | 8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b (patch) | |
tree | cd0de6a4642b76b42002dae5291c307d30727bc6 /usecases/desktop/graphical/waybar.nix | |
parent | 46ac3d5464712d6b0e0bee4ac62543abcbf2db2c (diff) | |
download | nixos-config-reborn-8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b.tar.gz nixos-config-reborn-8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b.zip |
revamp with nix flakes + desktop config
Diffstat (limited to 'usecases/desktop/graphical/waybar.nix')
-rw-r--r-- | usecases/desktop/graphical/waybar.nix | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/usecases/desktop/graphical/waybar.nix b/usecases/desktop/graphical/waybar.nix new file mode 100644 index 0000000..dca43a2 --- /dev/null +++ b/usecases/desktop/graphical/waybar.nix | |||
@@ -0,0 +1,288 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, lib, pkgs, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson = { | ||
7 | programs.waybar = { | ||
8 | enable = true; | ||
9 | |||
10 | settings = [{ | ||
11 | layer = "top"; | ||
12 | position = "bottom"; | ||
13 | height = 25; | ||
14 | |||
15 | modules-left = [ "sway/workspaces" "sway/mode" ]; | ||
16 | modules-center = [ "mpd" ]; | ||
17 | modules-right = [ | ||
18 | "idle_inhibitor" | ||
19 | "pulseaudio" | ||
20 | "network#eth" | ||
21 | "network#wlan" | ||
22 | "cpu" | ||
23 | "memory" | ||
24 | "temperature" | ||
25 | "backlight" | ||
26 | "battery" | ||
27 | "clock" | ||
28 | "tray" | ||
29 | ]; | ||
30 | |||
31 | modules = { | ||
32 | mpd = { | ||
33 | format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) <span font_desc='Font Awesome 5 Free'></span>"; | ||
34 | format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped <span font_desc='Font Awesome 5 Free'></span>"; | ||
35 | format-disconnected = "Disconnected <span font_desc='Font Awesome 5 Free'></span>"; | ||
36 | |||
37 | on-click-middle = "${pkgs.alacritty}/bin/alacritty --command ncmpcpp"; | ||
38 | |||
39 | consume-icons = { | ||
40 | on = " "; | ||
41 | }; | ||
42 | |||
43 | random-icons = { | ||
44 | on = " "; | ||
45 | }; | ||
46 | |||
47 | repeat-icons = { | ||
48 | on = " "; | ||
49 | }; | ||
50 | |||
51 | single-icons = { | ||
52 | on = "1 "; | ||
53 | }; | ||
54 | |||
55 | state-icons = { | ||
56 | playing = ""; | ||
57 | paused = ""; | ||
58 | }; | ||
59 | }; | ||
60 | |||
61 | idle_inhibitor = { | ||
62 | format = "{icon}"; | ||
63 | format-icons = { | ||
64 | activated = ""; | ||
65 | deactivated = ""; | ||
66 | }; | ||
67 | }; | ||
68 | |||
69 | clock = { | ||
70 | tooltip-format = "{:%Y-%m-%d | %H:%M}"; | ||
71 | format-alt = "{:%Y-%m-%d}"; | ||
72 | }; | ||
73 | |||
74 | cpu = { format = "{usage}% "; }; | ||
75 | |||
76 | memory = { format = "{}% "; }; | ||
77 | |||
78 | battery = { | ||
79 | states = { good = 90; }; | ||
80 | format = "{capacity}% {icon}"; | ||
81 | format-icons = [ | ||
82 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
83 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
84 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
85 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
86 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
87 | ]; | ||
88 | }; | ||
89 | |||
90 | "network#eth" = { | ||
91 | interface = "enp*"; | ||
92 | format-ethernet = "{ipaddr}/{cidr} "; | ||
93 | format-disconnected = "Disconnected "; | ||
94 | }; | ||
95 | |||
96 | "network#wlan" = { | ||
97 | interface = "wlp*"; | ||
98 | format-wifi = "{essid} ({signalStrength}%) <span font_desc='Font Awesome 5 Free'></span>"; | ||
99 | format-disconnected = "Disconnected <span font_desc='Font Awesome 5 Free'></span>"; | ||
100 | tooltip = true; | ||
101 | tooltip-format-wifi = "{ipaddr}/{cidr}"; | ||
102 | }; | ||
103 | |||
104 | temperature = { | ||
105 | hwmon-path = "/sys/class/hwmon/hwmon0/temp1_input"; | ||
106 | format = "{temperatureC} °C "; | ||
107 | }; | ||
108 | |||
109 | backlight = { | ||
110 | format = "{percent}% <span font_desc='Font Awesome 5 Free'>{icon}</span>"; | ||
111 | format-icons = [ "" "" ]; | ||
112 | }; | ||
113 | |||
114 | pulseaudio = { | ||
115 | format = "{volume}% {icon}"; | ||
116 | format-bluetooth = "{volume}% {icon}"; | ||
117 | format-muted = ""; | ||
118 | format-icons = { | ||
119 | headphones = ""; | ||
120 | handsfree = ""; | ||
121 | headset = ""; | ||
122 | phone = ""; | ||
123 | portable = ""; | ||
124 | car = ""; | ||
125 | default = [ "" "" ]; | ||
126 | }; | ||
127 | on-click = "pavucontrol"; | ||
128 | }; | ||
129 | }; | ||
130 | }]; | ||
131 | |||
132 | style = with config.theme.colors; '' | ||
133 | * { | ||
134 | border: none; | ||
135 | border-radius: 0; | ||
136 | font-family: mono; | ||
137 | font-size: 11px; | ||
138 | min-height: 0; | ||
139 | } | ||
140 | |||
141 | window#waybar { | ||
142 | background: ${background}; | ||
143 | border-bottom: 3px solid ${lightBackground}; | ||
144 | color: ${foreground}; | ||
145 | } | ||
146 | |||
147 | /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ | ||
148 | #workspaces button { | ||
149 | padding: 0 5px; | ||
150 | background: transparent; | ||
151 | color: ${foreground}; | ||
152 | border-bottom: 3px solid transparent; | ||
153 | } | ||
154 | |||
155 | #workspaces button.focused { | ||
156 | background: ${dominant}; | ||
157 | border-bottom: 3px solid ${foreground}; | ||
158 | } | ||
159 | |||
160 | #mode { | ||
161 | background: ${lightBackground}; | ||
162 | border-bottom: 3px solid ${foreground}; | ||
163 | } | ||
164 | |||
165 | #clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #custom-mpd, #mpd, #tray, #mode, #idle_inhibitor { | ||
166 | padding: 0 10px; | ||
167 | margin: 0 5px; | ||
168 | } | ||
169 | |||
170 | #clock { | ||
171 | background-color: ${neutralMagenta}; | ||
172 | color: ${background}; | ||
173 | } | ||
174 | |||
175 | #battery { | ||
176 | background-color: ${neutralYellow}; | ||
177 | color: ${background}; | ||
178 | } | ||
179 | |||
180 | /* | ||
181 | #battery.charging { | ||
182 | color: ${foreground}; | ||
183 | background-color: #26A65B; | ||
184 | } | ||
185 | */ | ||
186 | |||
187 | @keyframes blink { | ||
188 | to { | ||
189 | background-color: ${foreground}; | ||
190 | color: ${background}; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | #battery.critical:not(.charging) { | ||
195 | background: ${fadedRed}; | ||
196 | color: ${foreground}; | ||
197 | animation-name: blink; | ||
198 | animation-duration: 0.5s; | ||
199 | animation-timing-function: linear; | ||
200 | animation-iteration-count: infinite; | ||
201 | animation-direction: alternate; | ||
202 | } | ||
203 | |||
204 | #cpu { | ||
205 | background: ${neutralOrange}; | ||
206 | color: ${background}; | ||
207 | } | ||
208 | |||
209 | #memory { | ||
210 | background: ${brightBlue}; | ||
211 | color: ${background}; | ||
212 | } | ||
213 | |||
214 | #backlight { | ||
215 | background: ${background6}; | ||
216 | color: ${background}; | ||
217 | } | ||
218 | |||
219 | #network { | ||
220 | background: ${neutralGreen}; | ||
221 | color: ${background}; | ||
222 | } | ||
223 | |||
224 | #network.disconnected { | ||
225 | background: ${lightBackground}; | ||
226 | color: ${foreground}; | ||
227 | } | ||
228 | |||
229 | #pulseaudio { | ||
230 | background: ${neutralCyan}; | ||
231 | color: ${background}; | ||
232 | } | ||
233 | |||
234 | #pulseaudio.muted { | ||
235 | background: ${foreground}; | ||
236 | } | ||
237 | |||
238 | #temperature { | ||
239 | background: ${brightCyan}; | ||
240 | color: ${background}; | ||
241 | } | ||
242 | |||
243 | #temperature.critical { | ||
244 | background: ${fadedRed}; | ||
245 | color: ${foreground}; | ||
246 | } | ||
247 | |||
248 | #tray { | ||
249 | background-color: #2980b9; | ||
250 | } | ||
251 | |||
252 | #idle_inhibitor { | ||
253 | background-color: ${lightBackground}; | ||
254 | } | ||
255 | |||
256 | #custom-mpd { | ||
257 | background-color: ${dominant}; | ||
258 | } | ||
259 | |||
260 | #mpd { | ||
261 | background: ${dominant}; | ||
262 | } | ||
263 | |||
264 | #mpd.disconnected { | ||
265 | background: ${lightBackground}; | ||
266 | color: ${foreground}; | ||
267 | } | ||
268 | |||
269 | #mpd.stopped { | ||
270 | background: ${foreground}; | ||
271 | color: ${background}; | ||
272 | } | ||
273 | |||
274 | #mpd.paused { | ||
275 | background: ${dimDominant}; | ||
276 | } | ||
277 | ''; | ||
278 | |||
279 | systemd.enable = true; | ||
280 | }; | ||
281 | |||
282 | # Fix https://github.com/nix-community/home-manager/pull/1628 | ||
283 | systemd.user.services.waybar.Unit = { | ||
284 | Requisite = lib.mkForce []; | ||
285 | After = lib.mkForce []; | ||
286 | }; | ||
287 | }; | ||
288 | } | ||