Skip to content

Commit c954416

Browse files
committed
niri: update new major version
1 parent 83af5c1 commit c954416

File tree

2 files changed

+96
-48
lines changed

2 files changed

+96
-48
lines changed

modules/home/class-laptop/niri.nix

Lines changed: 70 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
perSystem,
55
...
66
}: {
7+
home.packages = with pkgs; [
8+
xwayland-satellite
9+
];
710
programs.niri = {
811
package = perSystem.niri.niri-unstable;
912
settings = {
1013
gestures.hot-corners.enable = false;
11-
spawn-at-startup = [
12-
{
13-
command = ["${pkgs.xwayland-satellite}/bin/xwayland-satellite" ":42"];
14-
}
15-
];
16-
environment = {
17-
DISPLAY = ":42";
18-
};
1914
screenshot-path = "~/pictures/screenshot-%d-%m-%Y-%T.png";
2015
input = {
2116
workspace-auto-back-and-forth = true;
@@ -40,6 +35,7 @@
4035
natural-scroll = true;
4136
};
4237
};
38+
overview.backdrop-color = "#${config.colors.light_bg}";
4339
outputs = {
4440
"eDP-1" = {
4541
scale = 1.0;
@@ -56,51 +52,56 @@
5652
prefer-no-csd = true;
5753
layout = {
5854
empty-workspace-above-first = true;
59-
gaps = 0;
55+
gaps = 2;
56+
# struts = {
57+
# top = -6;
58+
# bottom = -6;
59+
# left = -6;
60+
# right = -6;
61+
# };
6062
shadow = {
6163
enable = false;
6264
color = "#${config.colors.blue}";
6365
inactive-color = "#${config.colors.light_bg}00"; # transparent
64-
spread = 1;
65-
softness = 15;
66-
offset = {
67-
x = 0;
68-
y = 0;
69-
};
7066
};
7167
focus-ring = {
7268
enable = true;
73-
width = 1;
74-
active.color = "#${config.colors.blue}00";
69+
width = 2;
70+
active.color = "#${config.colors.blue}";
7571
inactive.color = "#${config.colors.cyan}";
72+
urgent.color = "#${config.colors.red}";
7673
};
7774
border = {
78-
enable = true;
79-
width = 2;
80-
active.color = "#${config.colors.blue}";
81-
inactive.color = "#${config.colors.light_bg}";
75+
enable = false;
76+
width = 1;
77+
active.color = "#${config.colors.blue}00";
78+
inactive.color = "#${config.colors.light_bg}00";
79+
urgent.color = "#${config.colors.red}";
8280
};
83-
default-column-width.proportion = 0.333;
81+
default-column-width.proportion = 0.4;
8482
preset-column-widths = [
85-
{proportion = 0.333;}
83+
{proportion = 0.3;}
84+
{proportion = 0.4;}
8685
{proportion = 0.5;}
87-
{proportion = 0.667;}
86+
{proportion = 0.6;}
87+
{proportion = 0.7;}
8888
];
8989
preset-window-heights = [
90-
{proportion = 0.333;}
90+
{proportion = 0.333333;}
9191
{proportion = 0.5;}
92-
{proportion = 0.667;}
92+
{proportion = 0.666667;}
9393
];
9494
tab-indicator = {
95-
position = "right";
95+
position = "top";
9696
place-within-column = true;
97-
gap = 0;
98-
width = 7;
99-
gaps-between-tabs = 5;
100-
length.total-proportion = 0.2;
97+
gap = 5;
98+
width = 4;
99+
gaps-between-tabs = 8;
100+
length.total-proportion = 0.3;
101101
corner-radius = 5;
102102
active.color = "#${config.colors.blue}";
103103
inactive.color = "#${config.colors.light_bg}";
104+
urgent.color = "#${config.colors.red}";
104105
};
105106
insert-hint.display.color = "#${config.colors.green}88";
106107
};
@@ -129,24 +130,52 @@
129130
];
130131
open-floating = true;
131132
}
133+
{
134+
matches = [
135+
{app-id = "kitty";}
136+
];
137+
default-column-width = {proportion = 0.3;};
138+
}
139+
{
140+
matches = [
141+
{is-urgent = true;}
142+
];
143+
shadow = {
144+
enable = true;
145+
softness = 0;
146+
spread = 2;
147+
offset = {
148+
x = 0;
149+
y = 0;
150+
};
151+
color = "#${config.colors.bright-red}";
152+
};
153+
}
132154
{
133155
matches = [
134156
{is-window-cast-target = true;}
135157
];
136-
border = {
158+
focus-ring = {
159+
enable = true;
160+
width = 2;
137161
active.color = "#${config.colors.bright-red}";
138-
inactive.color = "#${config.colors.red}";
162+
inactive.color = "#${config.colors.bright-red}";
139163
};
140164
shadow = {
141165
enable = true;
142-
color = "#${config.colors.red}";
166+
softness = 8;
167+
spread = 3;
168+
offset = {
169+
x = 0;
170+
y = 0;
171+
};
172+
color = "#${config.colors.bright-red}";
143173
};
144174
}
145175
{
146176
matches = [
147177
{is-floating = true;}
148178
];
149-
# baba-is-float = true;
150179
shadow = {
151180
enable = true;
152181
color = "#${config.colors.blue}";
@@ -207,13 +236,12 @@
207236

208237
# window width
209238
"Mod+R".action = switch-preset-column-width;
210-
"Mod+Comma".action = set-column-width "33.3%";
211-
"Mod+Period".action = set-column-width "66.7%";
212-
"Mod+Slash".action = set-column-width "50%";
239+
"Mod+Period".action = switch-preset-column-width;
240+
"Mod+Comma".action = switch-preset-column-width-back;
213241
"Mod+M".action = maximize-column;
214242
"Mod+Ctrl+M".action = expand-column-to-available-width;
215-
"Mod+XF86AudioRaiseVolume".action = set-column-width "+1%";
216-
"Mod+XF86AudioLowerVolume".action = set-column-width "-1%";
243+
"Mod+XF86AudioRaiseVolume".action = switch-preset-column-width;
244+
"Mod+XF86AudioLowerVolume".action = switch-preset-column-width-back;
217245

218246
# window height
219247
"Mod+Shift+R".action = switch-preset-window-height;
@@ -234,8 +262,8 @@
234262
"Ctrl+Print".action = screenshot-window;
235263

236264
# focus
237-
# "Mod+H".action = focus-column-left-or-last;
238-
# "Mod+L".action = focus-column-right-or-first;
265+
"Mod+Backspace".action = focus-column-first;
266+
"Mod+Shift+Backspace".action = focus-column-last;
239267
"Mod+H".action = focus-column-or-monitor-left;
240268
"Mod+J".action = focus-window-or-workspace-down;
241269
"Mod+K".action = focus-window-or-workspace-up;
@@ -264,12 +292,6 @@
264292
"Mod+Shift+Tab".action = move-window-to-monitor-next;
265293
"Mod+Ctrl+Tab".action = move-workspace-to-monitor-next;
266294

267-
# special focus
268-
"Mod+BracketLeft".action = focus-column-first;
269-
"Mod+Shift+BracketLeft".action = move-column-to-first;
270-
"Mod+BracketRight".action = focus-column-last;
271-
"Mod+Shift+BracketRight".action = move-column-to-last;
272-
273295
# laptop screen
274296
"Mod+Equal".action = spawn "niri" "msg" "output" "eDP-1" "on";
275297
"Mod+Shift+Equal".action = spawn "niri" "msg" "output" "eDP-1" "off";

modules/home/class-laptop/waybar.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
reload_style_on_change = true;
1717
modules-left = [
1818
"niri/workspaces"
19+
# "custom/winpos"
1920
];
2021
modules-center = [
2122
"pulseaudio#mic"
@@ -120,6 +121,31 @@
120121
on-scroll-down = "niri msg action focus-column-right-or-first";
121122
on-scroll-up = "niri msg action focus-column-left-or-last";
122123
};
124+
"custom/winpos" = {
125+
exec = pkgs.writeScript "./winpos.sh" ''
126+
#!/bin/sh
127+
128+
active_window_id="$(niri msg -j workspaces | jq -r '.[]|select(.is_focused==true).active_window_id')"
129+
total_columns="$(niri msg -j windows | jq -r '[.[] | .layout.pos_in_scrolling_layout[0]] | max')"
130+
current_column=$(niri msg -j windows | jq -r ".[]|select(.id==$active_window_id).layout.pos_in_scrolling_layout[0]")
131+
echo $(( $current_column - 1 )) $(( $total_columns - $current_column ))
132+
133+
niri msg -j event-stream |\
134+
while read -r line; do
135+
event="$(echo $line | jq --unbuffered -r 'keys.[0]')"
136+
case "$event" in
137+
"WindowFocusChanged"|"WindowLayoutsChanged"|"WorkspaceActivated"|"WorkspaceActiveWindowChanged"|"WindowOpenedOrChanged")
138+
active_window_id="$(niri msg -j workspaces | jq -r '.[]|select(.is_focused==true).active_window_id')"
139+
total_columns="$(niri msg -j windows | jq -r '[.[] | .layout.pos_in_scrolling_layout[0]] | max')"
140+
current_column=$(niri msg -j windows | jq -r ".[]|select(.id==$active_window_id).layout.pos_in_scrolling_layout[0]")
141+
echo $(( $current_column - 1 )) $(( $total_columns - $current_column )) || exit
142+
;;
143+
esac
144+
done
145+
'';
146+
on-scroll-down = "niri msg action focus-column-right-or-first";
147+
on-scroll-up = "niri msg action focus-column-left-or-last";
148+
};
123149
disk = {
124150
rotate = 90;
125151
format = "󰋊 {percentage_used}%";

0 commit comments

Comments
 (0)