···
9
+
commonDeps = with pkgs; [coreutils gnugrep systemd];
10
+
# Function to simplify making waybar outputs
16
+
lib.getExe (pkgs.writeShellApplication {
19
+
runtimeInputs = commonDeps ++ deps;
21
+
# Specialized for JSON outputs
34
+
deps = [pkgs.jq] ++ deps;
38
+
--arg text "${text}" \
39
+
--arg tooltip "${tooltip}" \
40
+
--arg alt "${alt}" \
41
+
--arg class "${class}" \
42
+
--arg percentage "${percentage}" \
43
+
'{text:$text,tooltip:$tooltip,alt:$alt,class:$class,percentage:$percentage}'
47
+
swayCfg = config.wayland.windowManager.sway;
48
+
hyprlandCfg = config.wayland.windowManager.hyprland;
50
+
# Let it try to start a few more times
51
+
systemd.user.services.waybar = {
52
+
Unit.StartLimitBurst = 30;
56
+
package = pkgs.waybar.overrideAttrs (oa: {
57
+
mesonFlags = (oa.mesonFlags or []) ++ ["-Dexperimental=true"];
59
+
systemd.enable = true;
63
+
passthrough = false;
69
+
++ (lib.optionals swayCfg.enable [
73
+
++ (lib.optionals hyprlandCfg.enable [
74
+
"hyprland/workspaces"
78
+
"custom/currentplayer"
88
+
"custom/unread-mail"
92
+
# "custom/gammastep" TODO: currently broken for some reason
101
+
format = "{:%d/%m %H:%M:%S}";
102
+
format-alt = "{:%Y-%m-%d %H:%M:%S %z}";
103
+
on-click-left = "mode";
104
+
tooltip-format = ''
105
+
<big>{:%Y %B}</big>
106
+
<tt><small>{calendar}</small></tt>'';
110
+
format = " {usage}%";
119
+
format = "{icon} {volume}%";
120
+
format-muted = " 0%";
131
+
on-click = lib.getExe pkgs.pavucontrol;
156
+
format = "{icon} {capacity}%";
157
+
format-charging = " {capacity}%";
167
+
format-wifi = " {essid}";
168
+
format-ethernet = " Connected";
169
+
format-disconnected = " ";
170
+
tooltip-format = ''
173
+
Up: {bandwidthUpBits}
174
+
Down: {bandwidthDownBits}'';
179
+
return-type = "json";
180
+
exec = mkScriptJson {
181
+
deps = lib.optional hyprlandCfg.enable hyprlandCfg.package;
183
+
tooltip = ''$(grep PRETTY_NAME /etc/os-release | cut -d '"' -f2)'';
186
+
if hyprlandCfg.enable
187
+
then "hyprctl activewindow -j | jq -e '.fullscreen' &>/dev/null"
189
+
in "$(if ${isFullScreen}; then echo fullscreen; fi)";
193
+
"custom/hostname" = {
194
+
exec = mkScript {script = ''echo "$USER@$HOSTNAME"'';};
195
+
on-click = mkScript {script = "systemctl --user restart waybar";};
198
+
"custom/unread-mail" = {
200
+
return-type = "json";
201
+
exec = mkScriptJson {
202
+
deps = [pkgs.findutils pkgs.procps];
204
+
count=$(find ~/Mail/*/Inbox/new -type f | wc -l)
205
+
if pgrep mbsync &>/dev/null; then
208
+
if [ "$count" == "0" ]; then
218
+
format = "{icon} ({})";
226
+
"custom/currentplayer" = {
228
+
return-type = "json";
229
+
exec = mkScriptJson {
230
+
deps = [pkgs.playerctl];
232
+
player="$(playerctl status -f "{{playerName}}" 2>/dev/null || echo "No player active" | cut -d '.' -f1)"
233
+
count="$(playerctl -l 2>/dev/null | wc -l)"
234
+
if ((count > 1)); then
235
+
more=" +$((count - 1))"
241
+
tooltip = "$player ($count available)";
244
+
format = "{icon}{}";
246
+
"No player active" = " ";
247
+
"Celluloid" = " ";
250
+
"qutebrowser" = " ";
253
+
"sublimemusic" = " ";
254
+
"kdeconnect" = " ";
259
+
"custom/player" = {
260
+
exec-if = mkScript {
261
+
deps = [pkgs.playerctl];
262
+
script = "playerctl status 2>/dev/null";
265
+
format = ''{"text": "{{title}} - {{artist}}", "alt": "{{status}}", "tooltip": "{{title}} - {{artist}} ({{album}})"}'';
268
+
deps = [pkgs.playerctl];
269
+
script = "playerctl metadata --format '${format}' 2>/dev/null";
271
+
return-type = "json";
274
+
format = "{icon} {}";
280
+
on-click = mkScript {
281
+
deps = [pkgs.playerctl];
282
+
script = "playerctl play-pause";
289
+
# x y -> vertical, horizontal
290
+
# x y z -> top, horizontal, bottom
291
+
# w x y z -> top, right, bottom, left
293
+
inherit (inputs.nix-colors.lib.conversions) hexToRGBString;
294
+
inherit (config.colorscheme) colors;
295
+
toRGBA = color: opacity: "rgba(${hexToRGBString "," (lib.removePrefix "#" color)},${opacity})";
302
+
font-family: Fira Sans, FiraCode Nerd Font;
310
+
border-radius: 0.5em;
311
+
background-color: shade(@surface0, 0.7);
315
+
margin-left: -0.65em;
318
+
margin-right: -0.65em;
321
+
#workspaces button {
322
+
background-color: @surface0;
324
+
padding-left: 0.4em;
325
+
padding-right: 0.4em;
326
+
margin-top: 0.15em;
327
+
margin-bottom: 0.15em;
329
+
#workspaces button.hidden {
330
+
background-color: @surface0;
333
+
#workspaces button.focused,
334
+
#workspaces button.active {
335
+
background-color: @blue;
340
+
padding-right: 1em;
342
+
border-radius: 0.5em;
346
+
background-color: @surface3;
348
+
padding-right: 1.5em;
351
+
border-radius: 0.5em;
353
+
#custom-menu.fullscreen {
354
+
background-color: @blue;
358
+
background-color: @surface3;
360
+
padding-right: 1em;
363
+
border-radius: 0.5em;
365
+
#custom-currentplayer {
371
+
#custom-gpu, #cpu, #memory {
372
+
margin-left: 0.05em;
373
+
margin-right: 0.55em;