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