flake-update-20260505
  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
 22output "eDP-1" {
 23    mode "1920x1200@60.003"
 24    scale 1
 25    transform "normal"
 26    position x=0 y=1440
 27}
 28
 29output "eDP-2" {
 30    mode "1920x1200@144.001"
 31    scale 1
 32    transform "normal"
 33    position x=0 y=0
 34}
 35
 36output "LG Electronics LG ULTRAWIDE 0x0005D10C" {
 37    mode "3440x1440@59.973"
 38    scale 1
 39    transform "normal"
 40    position x=0 y=0
 41}
 42
 43hotkey-overlay {
 44    skip-at-startup
 45}
 46
 47layout {
 48    gaps 6
 49    center-focused-column "never"
 50
 51    preset-column-widths {
 52        // The default preset widths are 1/3, 1/2 and 2/3 of the output.
 53        proportion 0.33333
 54        proportion 0.5
 55        proportion 0.66667
 56    }
 57
 58    default-column-width { proportion 0.5; }
 59
 60    focus-ring {
 61        off
 62        width 2
 63        active-color "#7fc8ff"
 64        inactive-color "#505050"
 65    }
 66
 67    border {
 68        width 2
 69        active-color "#ffc87f"
 70        inactive-color "#505050"
 71        urgent-color "#9b0000"
 72    }
 73    // Struts shrink the area occupied by windows, similarly to layer-shell panels.
 74    // You can think of them as a kind of outer gaps. They are set in logical pixels.
 75    // Left and right struts will cause the next window to the side to always be visible.
 76    // Top and bottom struts will simply add outer gaps in addition to the area occupied by
 77    // layer-shell panels and regular gaps.
 78    struts {
 79        left 6
 80        right 6
 81        // top 12
 82        // bottom 12
 83    }
 84}
 85
 86spawn-at-startup "dbus-update-activation-environment" "--systemd" "WAYLAND_DISPLAY" "DISPLAY" "DBUS_SESSION_BUS_ADDRESS" "SWAYSOCK" "XDG_SESSION_TYPE" "XDG_SESSION_DESKTOP" "XDG_CURRENT_DESKTOP"
 87spawn-at-startup "dbus-update-activation-environment" "--systemd" "--all"
 88spawn-at-startup "emacs" "--fg-daemon"
 89spawn-at-startup "battery-monitor"
 90spawn-at-startup "waybar"
 91// Disabled - using FIDO2 keys with ssh-agent instead of PIV with yubikey-agent
 92// spawn-at-startup "yubikey-agent" "-l" "/run/user/1000/yubikey-agent/yubikey-agent.sock"
 93spawn-at-startup "swaybg" "-i" "/home/vincent/desktop/pictures/lockscreen"
 94spawn-at-startup "jamesdsp" "-t"
 95
 96prefer-no-csd
 97
 98// screenshot-path is handled by shotty
 99screenshot-path null
100
101animations {
102    // Uncomment to turn off all animations.
103    // off
104
105    // Slow down all animations by this factor. Values below 1 speed them up instead.
106    // slowdown 3.0
107}
108
109window-rule {
110    // This regular expression is intentionally made as specific as possible,
111    // since this is the default config, and we want no false positives.
112    // You can get away with just app-id="wezterm" if you want.
113    match app-id=r#"^org\.wezfurlong\.wezterm$"#
114    default-column-width {}
115}
116
117// Open the Firefox picture-in-picture player as floating by default.
118window-rule {
119    // This app-id regular expression will work for both:
120    // - host Firefox (app-id is "firefox")
121    // - Flatpak Firefox (app-id is "org.mozilla.firefox")
122    match app-id=r#"firefox$"# title="^Picture-in-Picture$"
123    open-floating true
124}
125
126// Open raffi launcher as floating
127window-rule {
128    match app-id=r#"^com\.chmouel\.raffi$"#
129    open-floating true
130    default-column-width { fixed 800; }
131}
132
133// Open Emacs org-capture frame as floating and centered
134window-rule {
135    match app-id="emacs" title="capture"
136    open-floating true
137    default-column-width { proportion 0.4; }
138    default-window-height { proportion 0.55; }
139}
140
141window-rule {
142    match is-floating=true
143    shadow {
144        on
145    }
146}
147
148// Example: block out two password managers from screen capture.
149// (This example rule is commented out with a "/-" in front.)
150/-window-rule {
151    match app-id=r#"^org\.keepassxc\.KeePassXC$"#
152    match app-id=r#"^org\.gnome\.World\.Secrets$"#
153
154    block-out-from "screen-capture"
155
156    // Use this instead if you want them visible on third-party screenshot tools.
157    // block-out-from "screencast"
158}
159
160// All window have rounde corners and open "big"
161window-rule {
162    geometry-corner-radius 6
163    clip-to-geometry true
164    default-column-width { proportion 0.75; }
165}
166
167window-rule {
168    match is-window-cast-target=true
169
170    focus-ring {
171        active-color "#f38ba8"
172        inactive-color "#7d0d2d"
173    }
174
175    border {
176        inactive-color "#7d0d2d"
177    }
178
179    shadow {
180        color "#7d0d2d70"
181    }
182
183    tab-indicator {
184        active-color "#f38ba8"
185        inactive-color "#7d0d2d"
186    }
187}
188
189binds {
190    // Keys consist of modifiers separated by + signs, followed by an XKB key name
191    // in the end. To find an XKB name for a particular key, you may use a program
192    // like wev.
193    //
194    // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt
195    // when running as a winit window.
196    //
197    // Most actions that you can bind here can also be invoked programmatically with
198    // `niri msg action do-something`.
199
200    Mod+Shift+Slash { show-hotkey-overlay; }
201
202    // Mod+T hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty"; }
203    Mod+M { spawn "kitten" "quick-access-terminal"; }
204    Mod+Return hotkey-overlay-title="Open a Terminal" { spawn "kitty-launch"; }
205    Mod+Shift+Return hotkey-overlay-title="Open Emacs (client)" { spawn "emacsclient" "-c"; }
206    Mod+Control+Return hotkey-overlay-title="Open Emacs" { spawn "emacs"; }
207    Mod+Control+Alt+Return hotkey-overlay-title="Open Emacs Anywhere" { spawn "emacsclient" "-eval" "(vde/type)"; }
208    Mod+Shift+D hotkey-overlay-title="Run an Application" { spawn "fuzzel"; }
209    Mod+D hotkey-overlay-title="Run Raffi" { spawn "raffi"; }
210    Mod+F3 hotkey-overlay-title="Voice-to-text (Push-to-talk)" { spawn "voxtype" "record" "toggle"; }
211    // FIXME do not use nix run, but needs niri configuration
212    Mod+Control+D hotkey-overlay-title="Emoji picker" { spawn "rofimoji" "--selector" "fuzzel" "--clipboarder" "wl-copy" "--typer" "wtype" "--action" "type" "copy"; }
213    Mod+Control+V hotkey-overlay-title="Clipboard History" { spawn "bash" "-c" "cliphist list | fuzzel --dmenu --width=100 --lines=20 | cliphist decode | wl-copy"; }
214    Mod+Control+Shift+V hotkey-overlay-title="Delete Clipboard Entry" { spawn "bash" "-c" "cliphist list | fuzzel --dmenu --width=100 --lines=20 | cliphist delete"; }
215    Super+Alt+L hotkey-overlay-title="Lock the Screen" { spawn "swaylock" "-m" "fill" "-i" "/home/vincent/desktop/pictures/lockscreen"; }
216
217    // You can also use a shell. Do this if you need pipes, multiple commands, etc.
218    // Note: the entire command goes as a single argument in the end.
219    // Mod+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; }
220    // bindcode ${mod}+42 exec wl-kbptr -o modes=floating','click -o mode_floating.source=detect
221    //  bindcode ${mod}+Shift+42 mode Mouse
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}