examples: Update niri configuration.

* modules/rosenthal/examples/niri.kdl: Update and adjust.
This commit is contained in:
Hilton Chain 2025-09-07 22:15:33 +08:00
parent 3d5946a604
commit 1d06558776
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292

View File

@ -5,11 +5,11 @@
// This config is in the KDL format: https://kdl.dev // This config is in the KDL format: https://kdl.dev
// "/-" comments out the following node. // "/-" comments out the following node.
// Check the wiki for a full description of the configuration: // Check the wiki for a full description of the configuration:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Overview // https://yalter.github.io/niri/Configuration:-Introduction
// Input device configuration. // Input device configuration.
// Find the full list of options on the wiki: // Find the full list of options on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Input // https://yalter.github.io/niri/Configuration:-Input
input { input {
keyboard { keyboard {
xkb { xkb {
@ -19,18 +19,28 @@ input {
// For example: // For example:
// layout "us,ru" // layout "us,ru"
// options "grp:win_space_toggle,compose:ralt,ctrl:nocaps" // options "grp:win_space_toggle,compose:ralt,ctrl:nocaps"
// If this section is empty, niri will fetch xkb settings
// from org.freedesktop.locale1. You can control these using
// localectl set-x11-keymap.
} }
// Enable numlock on startup, omitting this setting disables it.
numlock
repeat-delay 300 repeat-delay 300
repeat-rate 30 repeat-rate 30
} }
// Next sections include libinput settings. // Next sections include libinput settings.
// Omitting settings disables them, or leaves them at their default values. // Omitting settings disables them, or leaves them at their default values.
// All commented-out settings here are examples, not defaults.
touchpad { touchpad {
// off // off
tap tap
// dwt // dwt
// dwtp // dwtp
// drag false
// drag-lock // drag-lock
natural-scroll natural-scroll
// accel-speed 0.2 // accel-speed 0.2
@ -54,6 +64,7 @@ input {
// accel-profile "flat" // accel-profile "flat"
// scroll-method "on-button-down" // scroll-method "on-button-down"
// scroll-button 273 // scroll-button 273
// scroll-button-lock
// middle-emulation // middle-emulation
} }
@ -69,7 +80,7 @@ input {
// by running `niri msg outputs` while inside a niri instance. // by running `niri msg outputs` while inside a niri instance.
// The built-in laptop monitor is usually called "eDP-1". // The built-in laptop monitor is usually called "eDP-1".
// Find more information on the wiki: // Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs // https://yalter.github.io/niri/Configuration:-Outputs
// Remember to uncomment the node by removing "/-"! // Remember to uncomment the node by removing "/-"!
/-output "eDP-1" { /-output "eDP-1" {
// Uncomment this line to disable this output. // Uncomment this line to disable this output.
@ -104,7 +115,7 @@ input {
// Settings that influence how windows are positioned and sized. // Settings that influence how windows are positioned and sized.
// Find more information on the wiki: // Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout // https://yalter.github.io/niri/Configuration:-Layout
layout { layout {
// Set gaps around windows in logical pixels. // Set gaps around windows in logical pixels.
gaps 16 gaps 16
@ -166,6 +177,9 @@ layout {
active-color "#7fc8ff" active-color "#7fc8ff"
// Color of the ring on inactive monitors. // Color of the ring on inactive monitors.
//
// The focus ring only draws around the active window, so the only place
// where you can see its inactive-color is on other monitors.
inactive-color "#505050" inactive-color "#505050"
// You can also use gradients. They take precedence over solid colors. // You can also use gradients. They take precedence over solid colors.
@ -175,7 +189,7 @@ layout {
// You can use any CSS linear-gradient tool on the web to set these up. // You can use any CSS linear-gradient tool on the web to set these up.
// Changing the color space is also supported, check the wiki for more info. // Changing the color space is also supported, check the wiki for more info.
// //
// active-gradient from="#80c8ff" to="#bbddff" angle=45 // active-gradient from="#80c8ff" to="#c7ff7f" angle=45
// You can also color the gradient relative to the entire view // You can also color the gradient relative to the entire view
// of the workspace, rather than relative to just the window itself. // of the workspace, rather than relative to just the window itself.
@ -194,7 +208,14 @@ layout {
active-color "#ffc87f" active-color "#ffc87f"
inactive-color "#505050" inactive-color "#505050"
// active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view" // Color of the border around windows that request your attention.
urgent-color "#9b0000"
// Gradients can use a few different interpolation color spaces.
// For example, this is a pastel rainbow gradient via in="oklch longer hue".
//
// active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue"
// inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
} }
@ -252,7 +273,17 @@ layout {
// Note that running niri as a session supports xdg-desktop-autostart, // Note that running niri as a session supports xdg-desktop-autostart,
// which may be more convenient to use. // which may be more convenient to use.
// See the binds section below for more spawn examples. // See the binds section below for more spawn examples.
// spawn-at-startup "foot" "fish"
// This line starts waybar, a commonly used bar for Wayland compositors.
// spawn-at-startup "waybar"
// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup:
// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell"
hotkey-overlay {
// Uncomment this line to disable the "Important Hotkeys" pop-up at startup.
// skip-at-startup
}
// Uncomment this line to ask the clients to omit their client-side decorations if possible. // Uncomment this line to ask the clients to omit their client-side decorations if possible.
// If the client will specifically ask for CSD, the request will be honored. // If the client will specifically ask for CSD, the request will be honored.
@ -271,7 +302,7 @@ screenshot-path "~/Screenshot from %Y-%m-%d %H-%M-%S.png"
// Animation settings. // Animation settings.
// The wiki explains how to configure individual animations: // The wiki explains how to configure individual animations:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations // https://yalter.github.io/niri/Configuration:-Animations
animations { animations {
// Uncomment to turn off all animations. // Uncomment to turn off all animations.
// off // off
@ -282,7 +313,7 @@ animations {
// Window rules let you adjust behavior for individual windows. // Window rules let you adjust behavior for individual windows.
// Find more information on the wiki: // Find more information on the wiki:
// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules // https://yalter.github.io/niri/Configuration:-Window-Rules
// Work around WezTerm's initial configure bug // Work around WezTerm's initial configure bug
// by setting an empty default-column-width. // by setting an empty default-column-width.
@ -338,26 +369,35 @@ binds {
Mod+Shift+Slash { show-hotkey-overlay; } Mod+Shift+Slash { show-hotkey-overlay; }
// Suggested binds for running programs: terminal, app launcher, screen locker. // Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+T { spawn "foot"; } Mod+T hotkey-overlay-title="Open a Terminal: foot" { spawn "foot"; }
Mod+D { spawn "rofi" "-show" "drun"; } Mod+D hotkey-overlay-title="Run an Application: rofi" { spawn "rofi" "-show" "drun"; }
// Super+Alt+L { spawn "swaylock"; } // Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; }
// You can also use a shell. Do this if you need pipes, multiple commands, etc. // 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 in the end. // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`.
// Mod+T { spawn "bash" "-c" "notify-send hello && exec foot"; } // For example, this is a standard bind to toggle the screen reader (orca).
Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; }
// Example volume keys mappings for PipeWire & WirePlumber. // Example volume keys mappings for PipeWire & WirePlumber.
// The allow-when-locked=true property makes them work even when the session is locked. // The allow-when-locked=true property makes them work even when the session is locked.
XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } // Using spawn-sh allows to pass multiple arguments together with the command.
XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; }
XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } 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"; }
// Example brightness key mappings for light. // Example brightness key mappings for light.
// You can use regular spawn with multiple arguments too (to avoid going through "sh"),
// but you need to manually put each argument in separate "" quotes.
XF86MonBrightnessUp allow-when-locked=true { spawn "light" "-A" "10"; } XF86MonBrightnessUp allow-when-locked=true { spawn "light" "-A" "10"; }
XF86MonBrightnessDown allow-when-locked=true { spawn "light" "-U" "10"; } XF86MonBrightnessDown allow-when-locked=true { spawn "light" "-U" "10"; }
Mod+Q { close-window; } // 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.
Mod+O repeat=false { toggle-overview; }
Mod+Q repeat=false { close-window; }
Mod+Left { focus-column-left; } Mod+Left { focus-column-left; }
Mod+Down { focus-window-down; } Mod+Down { focus-window-down; }
@ -462,8 +502,8 @@ binds {
// These binds are also affected by touchpad's natural-scroll, so these // These binds are also affected by touchpad's natural-scroll, so these
// example binds are "inverted", since we have natural-scroll enabled for // example binds are "inverted", since we have natural-scroll enabled for
// touchpads by default. // touchpads by default.
// Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; } // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; }
// Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; } // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; }
// You can refer to workspaces by index. However, keep in mind that // You can refer to workspaces by index. However, keep in mind that
// niri is a dynamic workspace system, so these commands are kind of // niri is a dynamic workspace system, so these commands are kind of
@ -510,6 +550,8 @@ binds {
Mod+Period { expel-window-from-column; } Mod+Period { expel-window-from-column; }
Mod+R { switch-preset-column-width; } Mod+R { switch-preset-column-width; }
// Cycling through the presets in reverse order is also possible.
// Mod+R { switch-preset-column-width-back; }
Mod+Shift+R { switch-preset-window-height; } Mod+Shift+R { switch-preset-window-height; }
Mod+Ctrl+R { reset-window-height; } Mod+Ctrl+R { reset-window-height; }
Mod+F { maximize-column; } Mod+F { maximize-column; }
@ -521,6 +563,9 @@ binds {
Mod+C { center-column; } Mod+C { center-column; }
// Center all fully visible columns on screen.
Mod+Ctrl+C { center-visible-columns; }
// Finer width adjustments. // Finer width adjustments.
// This command can also: // This command can also:
// * set width in pixels: "1000" // * set width in pixels: "1000"
@ -576,11 +621,10 @@ binds {
Mod+Shift+P { power-off-monitors; } Mod+Shift+P { power-off-monitors; }
} }
// Rootless Xwayland support
spawn-at-startup "xwayland-satellite" ":233"
environment {
DISPLAY ":233"
}
// Start user Shepherd // Start user Shepherd
spawn-at-startup "sh" "-c" "pgrep --uid $USER shepherd > /dev/null || shepherd" spawn-at-startup "sh" "-c" "pgrep --uid $USER shepherd > /dev/null || shepherd"
overview {
backdrop-color "#D2DEE9"
}