From 70be5b4865d858fa4fab3eeb1b632b4c96e39e82 Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Fri, 6 Nov 2026 14:11:31 +0100 Subject: Wayland: Add niri config --- .config/niri/config.kdl | 264 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 .config/niri/config.kdl (limited to '.config/niri/config.kdl') diff --git a/.config/niri/config.kdl b/.config/niri/config.kdl new file mode 100644 index 0000000..ff527bb --- /dev/null +++ b/.config/niri/config.kdl @@ -0,0 +1,264 @@ +// Settings that influence how windows are positioned and sized. +layout { + // Set gaps around windows in logical pixels. + gaps 10 + + // When to center a column when changing focus, options are: + // - "never", default behavior, focusing an off-screen column will keep at the left + // or right edge of the screen. + // - "always", the focused column will always be centered. + // - "on-overflow", focusing a column will center it if it doesn't fit + // together with the previously focused column. + center-focused-column "never" + always-center-single-column + + // You can customize the widths that "switch-preset-column-width" toggles between. + preset-column-widths { + // Proportion sets the width as a fraction of the output width, taking gaps into account. + // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. + // The default preset widths are 1/3, 1/2 and 2/3 of the output. + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + proportion 1.0 + } + + // You can also customize the heights that "switch-preset-window-height" toggles between. + preset-window-heights { + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + proportion 1.0 + + } + + // You can change the default width of the new windows. + default-column-width { proportion 0.5; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} + + // You can change how the focus ring looks. + focus-ring { + off + } + + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + on + + width 1.6 + active-color "#929be5" + inactive-color "#222432" + urgent-color "#490404" + } + background-color "#6a4d53" +} + +overview { + zoom 0.6 + backdrop-color "#222432" +} + +gestures { + hot-corners { + off + } +} + +recent-windows { + highlight { + active-color "#929be5" + urgent-color "#490404" + padding 20 + } +} + +// Spawn processes at startup. +// Note that running niri as a session supports xdg-desktop-autostart, +// which may be more convenient to use. + +spawn-at-startup "waybar" + +// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup: +spawn-sh-at-startup "wl-paste --watch cliphist store" + +hotkey-overlay { + skip-at-startup +} + +// Ask the clients to omit their client-side decorations if possible. +// If the client will specifically ask for CSD, the request will be honored. +// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. +// This option will also fix border/focus ring drawing behind some semitransparent windows. +// After enabling or disabling this, you need to restart the apps for this to take effect. +prefer-no-csd + +// You can change the path where screenshots are saved. +// A ~ at the front will be expanded to the home directory. +// The path is formatted with strftime(3) to give you the screenshot date and time. +screenshot-path "~/Pictures/Screens/%s-screen.png" + +// Animation settings +animations { + off +} + +// Window rules let you adjust behavior for individual windows. +window-rule { + match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"# + default-floating-position x=10 y=10 relative-to="bottom-right" +} + +// Open the Firefox picture-in-picture player as floating by default. +window-rule { + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +// Block out two password managers from screen capture. +/-window-rule { + match app-id=r#"^...$"# + + block-out-from "screen-capture" + + // Use this instead if you want them visible on third-party screenshot tools. + // block-out-from "screencast" +} + +binds { + // Keys consist of modifiers separated by + signs, followed by an XKB key name + // in the end. To find an XKB name for a particular key, you may use a program + // like wev. + + // Shows a list of important hotkeys. + Super+Ctrl+Alt+K { show-hotkey-overlay; } + + Ctrl+Alt+T hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; } + Super+Ctrl+Alt+space hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } + Super+Ctrl+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + // The quit action will show a confirmation dialog to avoid accidental exits. + Super+Ctrl+Alt+Q { quit; } + + // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. + // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. + Super+Ctrl+Alt+P hotkey-overlay-title=null { spawn-sh "fd . -e png -e jpg -e gif /mnt | fuzzel -w 100 -p 'Search and select image to open: ' -d | xargs -I {} xdg-open {}"; } + Super+Ctrl+Alt+D hotkey-overlay-title=null { spawn-sh "fd . -e pdf /mnt | fuzzel -w 100 -p 'Search and select document to open: ' -d | xargs -I {} xdg-open {}"; } + Super+Ctrl+Alt+V hotkey-overlay-title=null { spawn-sh "fd . -e webm -e mkv -e wmv -e avi -e mov -e qt -e mpeg -e mpg /mnt | fuzzel -w 100 -p 'Search and select video to open: ' -d | xargs -I {} xdg-open {}"; } + Super+Ctrl+Alt+C hotkey-overlay-title=null { spawn-sh "cliphist list | fuzzel -w 100 -d | cliphist decode | wl-copy"; } + // Hyprpicker won't work on Niri 26.04, because it doesn't have Niri's implementation of ext-image-copy-capture-v1 + // Super+Ctrl+Alt+X hotkey-overlay-title=null { spawn-sh "hyprpicker -a"; } + + // Volume keys mappings for PipeWire & WirePlumber. + // The allow-when-locked=true property makes them work even when the session is locked. + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; } + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } + + // Media keys mapping using playerctl. + // This will work with any MPRIS-enabled media player. + XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; } + XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; } + XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; } + XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; } + + // Open/close the Overview: a zoomed-out view of workspaces and windows. + // You can also move the mouse into the top-left hot corner, + // or do a four-finger swipe up on a touchpad. + Super+O repeat=false { toggle-overview; } + + Alt+F4 repeat=false { close-window; } + + Super+Left { focus-column-left; } + Super+Down { focus-window-down; } + Super+Up { focus-window-up; } + Super+Right { focus-column-right; } + + Super+Ctrl+Left { move-column-left; } + Super+Ctrl+Down { move-window-down; } + Super+Ctrl+Up { move-window-up; } + Super+Ctrl+Right { move-column-right; } + Super+Ctrl+H { move-column-left; } + Super+Ctrl+J { move-window-down; } + Super+Ctrl+K { move-window-up; } + Super+Ctrl+L { move-column-right; } + + Super+Home { focus-column-first; } + Super+End { focus-column-last; } + Super+Ctrl+Home { move-column-to-first; } + Super+Ctrl+End { move-column-to-last; } + + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Super+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Super+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Super+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Super+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Super+1 { focus-workspace 1; } + Super+2 { focus-workspace 2; } + Super+3 { focus-workspace 3; } + Super+4 { focus-workspace 4; } + Super+5 { focus-workspace 5; } + Super+6 { focus-workspace 6; } + Super+7 { focus-workspace 7; } + Super+8 { focus-workspace 8; } + Super+9 { focus-workspace 9; } + Super+Ctrl+1 { move-column-to-workspace 1; } + Super+Ctrl+2 { move-column-to-workspace 2; } + Super+Ctrl+3 { move-column-to-workspace 3; } + Super+Ctrl+4 { move-column-to-workspace 4; } + Super+Ctrl+5 { move-column-to-workspace 5; } + Super+Ctrl+6 { move-column-to-workspace 6; } + Super+Ctrl+7 { move-column-to-workspace 7; } + Super+Ctrl+8 { move-column-to-workspace 8; } + Super+Ctrl+9 { move-column-to-workspace 9; } + + // Cycle through widths set in preset-column-widths. + Super+W { switch-preset-column-width; } + + // Cycle through heights set in preset-column-heights. + Super+H { switch-preset-window-height; } + Super+Shift+H { reset-window-height; } + + Super+F { maximize-column; } + Super+Shift+F { fullscreen-window; } + + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Super+Ctrl+F { expand-column-to-available-width; } + + // Move the focused window between the floating and the tiling layout. + Super+V { toggle-window-floating; } + Super+Alt+V { switch-focus-between-floating-and-tiling; } + + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } + + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Super+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + +} -- cgit v1.2.3