main
1// Vincent Demeester niri configuration.
2// This config is in the KDL format: https://kdl.dev
3// "/-" comments out the following node.
4// Check the wiki for a full description of the configuration:
5// https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction
6
7input {
8 keyboard {
9 xkb {
10 layout "us,fr,fr"
11 variant "intl,bepo,ergol"
12 options "grp:menu_toggle,grp_led:caps,compose:caps"
13 }
14 numlock
15 }
16 touchpad {
17 tap
18 natural-scroll
19 }
20}
21
22// Disabled: let kanshi manage laptop screen enable/disable
23// output "eDP-2" {
24// mode "1920x1200@144.001"
25// scale 1
26// transform "normal"
27// position x=0 y=0
28// }
29
30output "LG Electronics LG ULTRAWIDE 0x0005D10C" {
31 mode "3440x1440@59.973"
32 scale 1
33 transform "normal"
34 position x=0 y=0
35}
36
37hotkey-overlay {
38 skip-at-startup
39}
40
41layout {
42 gaps 6
43 center-focused-column "never"
44
45 preset-column-widths {
46 // The default preset widths are 1/3, 1/2 and 2/3 of the output.
47 proportion 0.33333
48 proportion 0.5
49 proportion 0.66667
50 }
51
52 default-column-width { proportion 0.5; }
53
54 focus-ring {
55 off
56 width 2
57 active-color "#7fc8ff"
58 inactive-color "#505050"
59 }
60
61 border {
62 width 2
63 active-color "#ffc87f"
64 inactive-color "#505050"
65 urgent-color "#9b0000"
66 }
67 // Struts shrink the area occupied by windows, similarly to layer-shell panels.
68 // You can think of them as a kind of outer gaps. They are set in logical pixels.
69 // Left and right struts will cause the next window to the side to always be visible.
70 // Top and bottom struts will simply add outer gaps in addition to the area occupied by
71 // layer-shell panels and regular gaps.
72 struts {
73 left 6
74 right 6
75 // top 12
76 // bottom 12
77 }
78}
79
80spawn-at-startup "dbus-update-activation-environment" "--systemd" "WAYLAND_DISPLAY" "DISPLAY" "DBUS_SESSION_BUS_ADDRESS" "SWAYSOCK" "XDG_SESSION_TYPE" "XDG_SESSION_DESKTOP" "XDG_CURRENT_DESKTOP"
81spawn-at-startup "dbus-update-activation-environment" "--systemd" "--all"
82spawn-at-startup "emacs" "--fg-daemon"
83spawn-at-startup "battery-monitor"
84spawn-at-startup "waybar"
85// Disabled - using FIDO2 keys with ssh-agent instead of PIV with yubikey-agent
86// spawn-at-startup "yubikey-agent" "-l" "/run/user/1000/yubikey-agent/yubikey-agent.sock"
87spawn-at-startup "swaybg" "-i" "/home/vincent/desktop/pictures/lockscreen"
88spawn-at-startup "jamesdsp" "-t"
89
90prefer-no-csd
91
92// screenshot-path is handled by shotty
93screenshot-path null
94
95animations {
96 // Uncomment to turn off all animations.
97 // off
98
99 // Slow down all animations by this factor. Values below 1 speed them up instead.
100 // slowdown 3.0
101}
102
103window-rule {
104 // This regular expression is intentionally made as specific as possible,
105 // since this is the default config, and we want no false positives.
106 // You can get away with just app-id="wezterm" if you want.
107 match app-id=r#"^org\.wezfurlong\.wezterm$"#
108 default-column-width {}
109}
110
111// Open the Firefox picture-in-picture player as floating by default.
112window-rule {
113 // This app-id regular expression will work for both:
114 // - host Firefox (app-id is "firefox")
115 // - Flatpak Firefox (app-id is "org.mozilla.firefox")
116 match app-id=r#"firefox$"# title="^Picture-in-Picture$"
117 open-floating true
118}
119
120// Open raffi launcher as floating with blur
121window-rule {
122 match app-id=r#"^com\.chmouel\.raffi$"#
123 open-floating true
124 default-column-width { fixed 800; }
125 opacity 0.85
126 background-effect {
127 blur true
128 }
129}
130
131// Open Emacs org-capture frame as floating and centered
132window-rule {
133 match app-id="emacs" title="capture"
134 open-floating true
135 default-column-width { proportion 0.4; }
136 default-window-height { proportion 0.55; }
137}
138
139window-rule {
140 match is-floating=true
141 shadow {
142 on
143 }
144}
145
146// Example: block out two password managers from screen capture.
147// (This example rule is commented out with a "/-" in front.)
148/-window-rule {
149 match app-id=r#"^org\.keepassxc\.KeePassXC$"#
150 match app-id=r#"^org\.gnome\.World\.Secrets$"#
151
152 block-out-from "screen-capture"
153
154 // Use this instead if you want them visible on third-party screenshot tools.
155 // block-out-from "screencast"
156}
157
158// All window have rounde corners and open "big"
159window-rule {
160 geometry-corner-radius 6
161 clip-to-geometry true
162 default-column-width { proportion 0.75; }
163}
164
165window-rule {
166 match is-window-cast-target=true
167
168 focus-ring {
169 active-color "#f38ba8"
170 inactive-color "#7d0d2d"
171 }
172
173 border {
174 inactive-color "#7d0d2d"
175 }
176
177 shadow {
178 color "#7d0d2d70"
179 }
180
181 tab-indicator {
182 active-color "#f38ba8"
183 inactive-color "#7d0d2d"
184 }
185}
186
187binds {
188 // Keys consist of modifiers separated by + signs, followed by an XKB key name
189 // in the end. To find an XKB name for a particular key, you may use a program
190 // like wev.
191 //
192 // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt
193 // when running as a winit window.
194 //
195 // Most actions that you can bind here can also be invoked programmatically with
196 // `niri msg action do-something`.
197
198 Mod+Shift+Slash { show-hotkey-overlay; }
199
200 // Mod+T hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty"; }
201 Mod+M { spawn "kitten" "quick-access-terminal"; }
202 Mod+Return hotkey-overlay-title="Open a Terminal" { spawn "kitty-launch"; }
203 Mod+Shift+Return hotkey-overlay-title="Open Emacs (client)" { spawn "emacsclient" "-c"; }
204 Mod+Control+Return hotkey-overlay-title="Open Emacs" { spawn "emacs"; }
205 Mod+Control+Alt+Return hotkey-overlay-title="Open Emacs Anywhere" { spawn "emacsclient" "-eval" "(vde/type)"; }
206 Mod+Shift+D hotkey-overlay-title="Run an Application" { spawn "fuzzel"; }
207 Mod+D hotkey-overlay-title="Run Raffi" { spawn "raffi"; }
208 Mod+F3 hotkey-overlay-title="Voice-to-text (Push-to-talk)" { spawn "voxtype" "record" "toggle"; }
209 // FIXME do not use nix run, but needs niri configuration
210 Mod+Control+D hotkey-overlay-title="Emoji picker" { spawn "rofimoji" "--selector" "fuzzel" "--clipboarder" "wl-copy" "--typer" "wtype" "--action" "type" "copy"; }
211 Mod+Control+V hotkey-overlay-title="Clipboard History" { spawn "bash" "-c" "cliphist list | fuzzel --dmenu --width=100 --lines=20 | cliphist decode | wl-copy"; }
212 Mod+Control+Shift+V hotkey-overlay-title="Delete Clipboard Entry" { spawn "bash" "-c" "cliphist list | fuzzel --dmenu --width=100 --lines=20 | cliphist delete"; }
213 Super+Alt+L hotkey-overlay-title="Lock the Screen" { spawn "swaylock" "-m" "fill" "-i" "/home/vincent/desktop/pictures/lockscreen"; }
214
215 // You can also use a shell. Do this if you need pipes, multiple commands, etc.
216 // Note: the entire command goes as a single argument in the end.
217 // Mod+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; }
218 // bindcode ${mod}+42 exec wl-kbptr -o modes=floating','click -o mode_floating.source=detect
219 // bindcode ${mod}+Shift+42 mode Mouse
220 Mod+Z hotkey-overlay-title="Screen Magnifier" { spawn "wooz" "--invert-scroll"; }
221 Mod+E hotkey-overlay-title="Mouse click" { spawn "wl-kbptr" "-o" "modes=floating,click" "-o" "mode_floating.source=detect";}
222
223 Mod+T { spawn "bash" "-c" "notify-send --icon=clock --category=info --urgency=critical \"$(date +\"%I:%M\")\""; }
224 Mod+B { spawn "bash" "-c" "notify-send --icon=battery --category=info --urgency=critical \"$(acpi)\""; }
225 Mod+Shift+T hotkey-overlay-title="Toggle Color Scheme" { spawn "toggle-color-scheme"; }
226
227 Mod+Shift+B { spawn "pkill" "-USR1" "waybar"; }
228
229 // Example volume keys mappings for PipeWire & WirePlumber.
230 // The allow-when-locked=true property makes them work even when the session is locked.
231 XF86AudioRaiseVolume allow-when-locked=true { spawn "volumectl" "-u" "up"; }
232 XF86AudioLowerVolume allow-when-locked=true { spawn "volumectl" "-u" "down"; }
233 XF86AudioMute allow-when-locked=true { spawn "volumectl" "toggle-mute"; }
234
235 XF86AudioMicMute allow-when-locked=true { spawn "volumectl" "-m" "toggle-mute"; }
236 Ctrl+XF86AudioRaiseVolume allow-when-locked=true { spawn "volumectl" "-u" "-m" "up"; }
237 Ctrl+XF86AudioLowerVolume allow-when-locked=true { spawn "volumectl" "-u" "-m" "down"; }
238
239 XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
240 XF86Messenger allow-when-locked=true { spawn "playerctl" "play-pause"; }
241 XF86Favorites allow-when-locked=true { spawn "playerctl" "play-pause"; }
242 XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
243 XF86Go allow-when-locked=true { spawn "playerctl" "next"; }
244 XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
245 Cancel allow-when-locked=true { spawn "playerctl" "previous"; }
246
247 XF86MonBrightnessUp allow-when-locked=true { spawn "lightctl" "up"; }
248 XF86MonBrightnessDown allow-when-locked=true { spawn "lightctl" "down"; }
249 // Shift+XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "set" "1%+"; }
250 // Shift+XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "set" "1%-"; }
251
252 // Open/close the Overview: a zoomed-out view of workspaces and windows.
253 // You can also move the mouse into the top-left hot corner,
254 // or do a four-finger swipe up on a touchpad.
255 Mod+O repeat=false { toggle-overview; }
256
257 Mod+Q { close-window; }
258 Mod+Shift+Q { spawn "wlogout"; }
259
260 Mod+Left { focus-column-left; }
261 Mod+Down { focus-window-or-workspace-down; }
262 Mod+Up { focus-window-or-workspace-up; }
263 // Mod+Down { focus-window-down; }
264 // Mod+Up { focus-window-up; }
265 Mod+Right { focus-column-right; }
266
267 Mod+Ctrl+Left { move-column-left; }
268 // Mod+Ctrl+Down { move-window-down; }
269 // Mod+Ctrl+Up { move-window-up; }
270 Mod+Ctrl+Down { move-window-down-or-to-workspace-down; }
271 Mod+Ctrl+Up { move-window-up-or-to-workspace-up; }
272 Mod+Ctrl+Right { move-column-right; }
273
274 Mod+Home { focus-column-first; }
275 Mod+End { focus-column-last; }
276 Mod+Ctrl+Home { move-column-to-first; }
277 Mod+Ctrl+End { move-column-to-last; }
278
279 Mod+Shift+Left { focus-monitor-left; }
280 Mod+Shift+Down { focus-monitor-down; }
281 Mod+Shift+Up { focus-monitor-up; }
282 Mod+Shift+Right { focus-monitor-right; }
283
284 Mod+Shift+Ctrl+Left { move-column-to-monitor-left; }
285 Mod+Shift+Ctrl+Down { move-column-to-monitor-down; }
286 Mod+Shift+Ctrl+Up { move-column-to-monitor-up; }
287 Mod+Shift+Ctrl+Right { move-column-to-monitor-right; }
288
289 // Alternatively, there are commands to move just a single window:
290 // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; }
291 // ...
292
293 // And you can also move a whole workspace to another monitor:
294 // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; }
295 // ...
296 Mod+Page_Down { move-workspace-to-monitor-next; }
297 Mod+Page_Up { move-workspace-to-monitor-previous; }
298
299 // Mod+Page_Down { focus-workspace-down; }
300 // Mod+Page_Up { focus-workspace-up; }
301 Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
302 Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
303
304 // Alternatively, there are commands to move just a single window:
305 // Mod+Ctrl+Page_Down { move-window-to-workspace-down; }
306 // ...
307
308 Mod+Shift+Page_Down { move-workspace-down; }
309 Mod+Shift+Page_Up { move-workspace-up; }
310
311 Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
312 Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
313 Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
314 Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
315
316 Mod+WheelScrollRight { focus-column-right; }
317 Mod+WheelScrollLeft { focus-column-left; }
318 Mod+Ctrl+WheelScrollRight { move-column-right; }
319 Mod+Ctrl+WheelScrollLeft { move-column-left; }
320
321 // Usually scrolling up and down with Shift in applications results in
322 // horizontal scrolling; these binds replicate that.
323 Mod+Shift+WheelScrollDown { focus-column-right; }
324 Mod+Shift+WheelScrollUp { focus-column-left; }
325 Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
326 Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
327
328 // The following binds move the focused window in and out of a column.
329 // If the window is alone, they will consume it into the nearby column to the side.
330 // If the window is already in a column, they will expel it out.
331 Mod+BracketLeft { consume-or-expel-window-left; }
332 Mod+BracketRight { consume-or-expel-window-right; }
333
334 // Consume one window from the right to the bottom of the focused column.
335 Mod+Comma { consume-window-into-column; }
336 // Expel the bottom window from the focused column to the right.
337 Mod+Period { expel-window-from-column; }
338
339 Mod+R { switch-preset-column-width; }
340 Mod+Shift+R { switch-preset-window-height; }
341 Mod+Ctrl+R { reset-window-height; }
342 Mod+F { maximize-column; }
343 Mod+Shift+F { fullscreen-window; }
344
345 // Expand the focused column to space not taken up by other fully visible columns.
346 // Makes the column "fill the rest of the space".
347 Mod+Ctrl+F { expand-column-to-available-width; }
348
349 Mod+C { center-column; }
350
351 // Center all fully visible columns on screen.
352 Mod+Ctrl+C { center-visible-columns; }
353
354 // Finer width adjustments.
355 // This command can also:
356 // * set width in pixels: "1000"
357 // * adjust width in pixels: "-5" or "+5"
358 // * set width as a percentage of screen width: "25%"
359 // * adjust width as a percentage of screen width: "-10%" or "+10%"
360 // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0,
361 // set-column-width "100" will make the column occupy 200 physical screen pixels.
362 Mod+Minus { set-column-width "-10%"; }
363 Mod+Equal { set-column-width "+10%"; }
364
365 // Finer height adjustments when in column with other windows.
366 Mod+Shift+Minus { set-window-height "-10%"; }
367 Mod+Shift+Equal { set-window-height "+10%"; }
368
369 // Move the focused window between the floating and the tiling layout.
370 Mod+V { toggle-window-floating; }
371 Mod+Shift+V { switch-focus-between-floating-and-tiling; }
372
373 // Toggle tabbed column display mode.
374 // Windows in this column will appear as vertical tabs,
375 // rather than stacked on top of each other.
376 Mod+W { toggle-column-tabbed-display; }
377
378 // Actions to switch layouts.
379 Mod+Space { switch-layout "next"; }
380 Mod+Shift+Space { switch-layout "prev"; }
381
382 // Screenshots (shotty)
383 XF86SelectiveScreenshot { spawn "shotty" "select-file"; }
384 Print { spawn "shotty" "screen-file"; }
385 Ctrl+Print { spawn "shotty" "select-file"; }
386 Alt+Print { spawn "shotty" "window-file"; }
387 Shift+Print { spawn "shotty" "select-edit"; }
388
389 // Screen recording (shotty)
390 Mod+Print { spawn "shotty" "record-toggle"; }
391 Mod+Shift+Print { spawn "shotty" "record-pause"; }
392
393 // Applications such as rEmote-desktop clients and software KVM switches may
394 // request that niri stops processing the keyboard shortcuts defined here
395 // so they may, for example, forward the key presses as-is to a remote machine.
396 // It's a good idea to bind an escape hatch to toggle the inhibitor,
397 // so a buggy application can't hold your session hostage.
398 //
399 // The allow-inhibiting=false property can be applied to other binds as well,
400 // which ensures niri always processes them, even when an inhibitor is active.
401 Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
402
403 // The quit action will show a confirmation dialog to avoid accidental exits.
404 Mod+Shift+E { quit; }
405 Ctrl+Alt+Delete { quit; }
406
407 // Powers off the monitors. To turn them back on, do any input like
408 // moving the mousg or pressing any other key.
409 Mod+Shift+P { power-off-monitors; }
410}