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