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