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