Skip to content

Commit 1a3b714

Browse files
committed
waybar refactoring
1 parent 1f89b06 commit 1a3b714

File tree

1 file changed

+120
-122
lines changed

1 file changed

+120
-122
lines changed

home/wayland/waybar_new.nix

Lines changed: 120 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
config,
44
...
55
}: {
6-
home.packages = with pkgs; [
7-
playerctl
8-
];
96
programs.waybar = {
107
enable = true;
118
systemd = {
@@ -14,79 +11,77 @@
1411
};
1512
settings = [
1613
{
17-
"layer" = "top";
18-
"position" = "left";
19-
"reload_style_on_change" = true;
20-
"modules-left" = [
21-
"group/top"
22-
"idle_inhibitor"
23-
"group/audio"
24-
"pulseaudio#mic"
25-
];
26-
"modules-center" = [
14+
layer = "top";
15+
position = "left";
16+
reload_style_on_change = true;
17+
modules-left = [
2718
"niri/workspaces"
2819
];
29-
"modules-right" = [
20+
modules-center = [
21+
"pulseaudio#mic"
22+
];
23+
modules-right = [
24+
"group/audio"
3025
"systemd-failed-units"
3126
"tray"
3227
"battery"
33-
"clock"
28+
"idle_inhibitor"
29+
"group/bottom"
3430
];
35-
"battery" = {
36-
"rotate" = 90;
37-
"format" = "";
38-
"format-discharging" = "{icon} {capacity}% ({time})";
39-
"format-full" = "";
40-
"format-icons" = [
31+
battery = {
32+
rotate = 90;
33+
format = "";
34+
format-discharging = "{icon} {capacity}% ({time})";
35+
format-full = "";
36+
format-icons = [
4137
""
4238
""
4339
""
4440
""
4541
""
4642
];
47-
"format-time" = "{H}h {m}m";
48-
"interval" = 10;
49-
"states" = {
50-
"critical" = 10;
51-
"full" = 95;
52-
"warning" = 30;
43+
format-time = "{H}h {m}m";
44+
interval = 10;
45+
states = {
46+
critical = 10;
47+
full = 95;
48+
warning = 30;
5349
};
54-
"tooltip" = true;
50+
tooltip = true;
5551
};
56-
"clock" = {
57-
"actions" = {
58-
"on-click-right" = "mode";
59-
"on-scroll-down" = "shift_up";
60-
"on-scroll-up" = "shift_down";
52+
clock = {
53+
actions = {
54+
# on-click-right = "mode";
55+
# on-scroll-down = "shift_up";
56+
# on-scroll-up = "shift_down";
6157
};
62-
"calendar" = {
63-
"format" = {
64-
"days" = "<span color='#dcd7ba'>{}</span>";
65-
"months" = "<span color='#dcd7ba'>{}</span>";
66-
"today" = "<span color='#c34043'><b>{}</b></span>";
67-
"weekdays" = "<span color='#dcd7ba'>{}</span>";
68-
"weeks" = "<span color='#727169'>W{}</span>";
58+
calendar = {
59+
format = {
60+
days = "<span color='#dcd7ba'>{}</span>";
61+
months = "<span color='#dcd7ba'>{}</span>";
62+
today = "<span color='#c34043'><b>{}</b></span>";
63+
weekdays = "<span color='#dcd7ba'>{}</span>";
64+
weeks = "<span color='#727169'>W{}</span>";
6965
};
70-
"mode" = "month";
71-
"mode-mon-col" = 3;
72-
"on-scroll" = 1;
73-
"weeks-pos" = "left";
66+
mode = "year";
67+
mode-mon-col = 3;
68+
weeks-pos = "left";
7469
};
75-
"format" = "{:%H\n%M\n%S}";
76-
"interval" = 1;
77-
"tooltip-format" = "<tt>{calendar}</tt>";
70+
format = "{:%H\n%M\n%S}";
71+
interval = 1;
72+
tooltip-format = "<tt>{calendar}</tt>";
7873
};
79-
"cpu" = {
80-
"rotate" = 90;
81-
"format" = "󰊚 {usage}%";
82-
"interval" = 5;
83-
"states" = {
84-
"critical" = 90;
85-
"warning" = 70;
74+
cpu = {
75+
rotate = 90;
76+
format = "󰊚 {usage}%";
77+
interval = 5;
78+
states = {
79+
critical = 90;
80+
warning = 70;
8681
};
8782
};
8883
"custom/wincount" = {
89-
"exec" = pkgs.writeScript "./wincount.sh" ''
84+
exec = pkgs.writeScript "./wincount.sh" ''
9085
#!/bin/sh
9186
9287
idfocused="$(niri msg -j workspaces | jq ".[] | select(.is_focused == true ) | .id")"
@@ -105,101 +100,103 @@
105100
esac
106101
done
107102
'';
108-
"on-scroll-down" = "niri msg action focus-column-right-or-first";
109-
"on-scroll-up" = "niri msg action focus-column-left-or-last";
103+
on-scroll-down = "niri msg action focus-column-right-or-first";
104+
on-scroll-up = "niri msg action focus-column-left-or-last";
110105
};
111-
"disk" = {
112-
"rotate" = 90;
113-
"format" = "󰋊 {percentage_used}%";
114-
"interval" = 60;
115-
"path" = "/nix";
106+
disk = {
107+
rotate = 90;
108+
format = "󰋊 {percentage_used}%";
109+
interval = 60;
110+
path = "/nix";
116111
};
117-
"idle_inhibitor" = {
118-
"format" = "{icon}";
119-
"format-icons" = {
120-
"activated" = "";
121-
"deactivated" = "󰒲";
112+
idle_inhibitor = {
113+
format = "{icon}";
114+
format-icons = {
115+
activated = "";
116+
deactivated = "󰒲";
122117
};
123118
};
124119
"group/audio" = {
125-
"orientation" = "inherit";
126-
"drawer" = {
127-
"children-class" = "in-group";
120+
orientation = "inherit";
121+
drawer = {
122+
children-class = "in-group";
123+
transition-left-to-right = false;
128124
};
129-
"modules" = [
125+
modules = [
130126
"pulseaudio"
131127
"pulseaudio/slider"
132128
];
133129
};
134-
"group/top" = {
135-
"orientation" = "inherit";
136-
"drawer" = {
137-
"click-to-reveal" = true;
138-
"children-class" = "in-group";
130+
"group/bottom" = {
131+
orientation = "inherit";
132+
drawer = {
133+
click-to-reveal = true;
134+
transition-left-to-right = false;
135+
children-class = "in-group";
139136
};
140-
"modules" = [
141-
"custom/wincount"
137+
modules = [
138+
"clock"
142139
"cpu"
143140
"memory"
144141
"disk"
145142
];
146143
};
147-
"memory" = {
148-
"rotate" = 90;
149-
"format" = " {percentage}%";
150-
"interval" = 5;
151-
"states" = {
152-
"critical" = 90;
153-
"warning" = 85;
144+
memory = {
145+
rotate = 90;
146+
format = " {percentage}%";
147+
interval = 5;
148+
states = {
149+
critical = 90;
150+
warning = 85;
154151
};
155152
};
156153
"niri/window" = {
157-
"rotate" = 90;
158-
"format" = "{}";
159-
"on-scroll-down" = "niri msg action focus-column-right";
160-
"on-scroll-up" = "niri msg action focus-column-left";
161-
"separate-outputs" = true;
154+
rotate = 90;
155+
format = "{}";
156+
on-scroll-down = "niri msg action focus-column-right";
157+
on-scroll-up = "niri msg action focus-column-left";
158+
separate-outputs = true;
162159
};
163160
"niri/workspaces" = {
164-
"format" = "<span weight='1000'>{icon}</span>";
165-
"format-icons" = {
166-
"active" = "󰄯"; #󰄯 󰬪
167-
"default" = "󰄰"; #󰺕 󰄰 󰻂 󰻃
161+
format = "<span weight='1000'>{icon}</span>";
162+
format-icons = {
163+
active = "󰄯"; #󰄯 󰬪
164+
default = "󰄰"; #󰺕 󰄰 󰻂 󰻃
168165
};
169-
"on-scroll-down" = "niri msg action focus-workspace-down";
170-
"on-scroll-up" = "niri msg action focus-workspace-up";
171-
"on-update" = "niri msg -j workspaces | jq -r '.[]|select(.name!=null)|select(.active_window_id==null)|select(.is_active==false).name' | xargs -I{} niri msg action unset-workspace-name {}";
166+
on-scroll-down = "niri msg action focus-workspace-down";
167+
on-scroll-up = "niri msg action focus-workspace-up";
168+
on-update = "niri msg -j workspaces | jq -r '.[]|select(.name!=null)|select(.active_window_id==null)|select(.is_active==false).name' | xargs -I{} niri msg action unset-workspace-name {}";
172169
};
173-
"pulseaudio" = {
174-
"format" = "{icon}";
175-
"format-bluetooth" = "{icon}\n ";
176-
"format-icons" = {
177-
"default" = "";
178-
"speaker" = "";
179-
"speaker-muted" = "";
170+
pulseaudio = {
171+
format = "{icon}";
172+
format-bluetooth = "{icon}\n ";
173+
format-icons = {
174+
default = "";
175+
speaker = "";
176+
speaker-muted = "";
180177
};
181-
"format-muted" = "{icon}";
182-
"format-bluetooth-muted" = "{icon}\n ";
183-
"format-source" = "";
184-
"format-source-muted" = "";
185-
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
186-
"on-click-middle" = "${pkgs.pulseaudio}/bin/pactl set-default-sink $(${pkgs.pulseaudio}/bin/pactl list sinks short | ${pkgs.gnugrep}/bin/grep -v $(${pkgs.pulseaudio}/bin/pactl get-default-sink) | ${pkgs.coreutils}/bin/cut -f 1 | ${pkgs.coreutils}/bin/head -1)";
178+
format-muted = "{icon}";
179+
format-bluetooth-muted = "{icon}\n ";
180+
format-source = "";
181+
format-source-muted = "";
182+
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
183+
on-click-middle = "${pkgs.pulseaudio}/bin/pactl set-default-sink $(${pkgs.pulseaudio}/bin/pactl list sinks short | ${pkgs.gnugrep}/bin/grep -v $(${pkgs.pulseaudio}/bin/pactl get-default-sink) | ${pkgs.coreutils}/bin/cut -f 1 | ${pkgs.coreutils}/bin/head -1)";
187184
};
188185
"pulseaudio#mic" = {
189-
"format" = "{format_source}";
190-
"format-source" = "";
191-
"format-source-muted" = "";
192-
"tooltip" = false;
193-
"on-click" = "bash -c '${pkgs.swayosd}/bin/swayosd-client --input-volume=mute-toggle && pkill -SIGRTMIN+4 waybar'";
186+
format = "{format_source}";
187+
format-source = "";
188+
format-source-muted = "";
189+
tooltip = false;
190+
on-click = "bash -c '${pkgs.swayosd}/bin/swayosd-client --input-volume=mute-toggle && pkill -SIGRTMIN+4 waybar'";
194191
};
195192
"pulseaudio/slider" = {
196-
"orientation" = "vertical";
193+
orientation = "vertical";
197194
};
198-
"systemd-failed-units" = {
199-
"hide-on-ok" = true;
200-
"format" = "";
201-
"system" = true;
202-
"user" = true;
195+
systemd-failed-units = {
196+
hide-on-ok = true;
197+
format = "";
198+
system = true;
199+
user = true;
203200
};
204201
}
205202
];
@@ -233,7 +230,7 @@
233230
234231
/* workspaces */
235232
#workspaces {
236-
padding: 3em 0em;
233+
padding: 0em 0em 12em 0em;
237234
}
238235
#workspaces button {
239236
color: inherit; /* needed for some reason */
@@ -292,6 +289,7 @@
292289
color: #${config.colors.background};
293290
background-color: #${config.colors.red};
294291
}
292+
295293
#systemd-failed-units {
296294
color: #${config.colors.red};
297295
}

0 commit comments

Comments
 (0)