### Example: Run Wine with xwayland-run Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Xwayland.md An example demonstrating how to use xwayland-run to launch a Wine application with specific geometry and fullscreen settings. ```bash xwayland-run -geometry 800x600 -fullscreen -- wine wingame.exe ``` -------------------------------- ### Example Layer Rule Configuration Source: https://github.com/niri-wm/niri/wiki/Configuration:-Layer-Rules A comprehensive example demonstrating various matchers and properties for layer rules, including namespace, startup status, layer type, opacity, blocking, shadows, corner radius, and background effects. ```kdl layer-rule { match namespace="waybar" match at-startup=true match layer="top" // Properties that apply continuously. opacity 0.5 block-out-from "screencast" // block-out-from "screen-capture" shadow { on // off softness 40 spread 5 offset x=0 y=5 draw-behind-window true color "#00000064" // inactive-color "#00000064" } geometry-corner-radius 12 place-within-backdrop true baba-is-float true background-effect { xray true blur true noise 0.05 saturation 3 } popups { opacity 0.5 geometry-corner-radius 6 background-effect { xray true blur true noise 0.05 saturation 3 } } } ``` -------------------------------- ### XKB Key Name Detection Example Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Key-Bindings.md Example output from the 'wev' tool showing how to detect XKB key names for bindings. Look for the 'sym' field. ```text [14: wl_keyboard] key: serial: 757775; time: 44940343; key: 113; state: 1 (pressed) sym: Left (65361), utf8: '' [14: wl_keyboard] key: serial: 757776; time: 44940432; key: 113; state: 0 (released) sym: Left (65361), utf8: '' [14: wl_keyboard] key: serial: 757777; time: 44940753; key: 114; state: 1 (pressed) sym: Right (65363), utf8: '' [14: wl_keyboard] key: serial: 757778; time: 44940846; key: 114; state: 0 (released) sym: Right (65363), utf8: '' ``` -------------------------------- ### Install Niri on Ubuntu with DankMaterialShell Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md Install Niri and DankMaterialShell on Ubuntu 25.10 and above by adding the required PPAs and then installing the packages. ```bash sudo add-apt-repository ppa:avengemedia/danklinux sudo add-apt-repository ppa:avengemedia/dms sudo apt install niri dms ``` -------------------------------- ### Kanshi Profile for External Monitor Setup Source: https://github.com/niri-wm/niri/wiki/FAQ Example Kanshi configuration to manage output scaling and positioning based on connected monitors. This profile sets a specific scale for the laptop display when an external monitor is present. ```kdl profile { output eDP-1 enable scale 1.0 } ``` ```kdl profile { output HDMI-A-1 enable scale 1.0 position 0,0 output eDP-1 enable scale 1.25 position 1920,0 } ``` -------------------------------- ### Kanshi Configuration for Dynamic Output Scaling Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/FAQ.md Example Kanshi configuration profiles to adjust output scaling and positioning based on connected monitors. This allows for different display setups when external monitors are connected versus when only the laptop display is active. ```kanshi profile { output eDP-1 enable scale 1.0 } profile { output HDMI-A-1 enable scale 1.0 position 0,0 output eDP-1 enable scale 1.25 position 1920,0 } ``` -------------------------------- ### Spawn Action: Tilde Expansion at Start Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Key-Bindings.md The 'spawn' action expands a leading tilde (~) to the home directory only when it appears at the very beginning of the program name. ```kdl binds { // This will work: one ~ at the very beginning. Mod+T { spawn "~/scripts/do-something.sh"; } } ``` -------------------------------- ### Install Local Niri Build Source: https://github.com/niri-wm/niri/wiki/Development:-Developing-niri Overwrite the installed niri binary with a local release build for testing. Ensure you know how to revert to a stable version. ```bash sudo cp ./target/release/niri /usr/bin/niri ``` -------------------------------- ### Start Niri from TTY (non-systemd) Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md If not using a display manager and not on a systemd/dinit system, use 'niri --session' to start Niri from a TTY. This imports environment variables and starts D-Bus services. ```bash niri --session ``` -------------------------------- ### Spawn Programs at Niri Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Miscellaneous Add programs to launch automatically when Niri starts. Arguments are passed directly to the program binary. ```kdl spawn-at-startup "waybar" spawn-at-startup "alacritty" ``` -------------------------------- ### Comprehensive Window Rule Configuration Example Source: https://github.com/niri-wm/niri/wiki/Configuration:-Window-Rules Demonstrates a wide range of matchers and properties for window rules, including initial opening properties and continuous application properties. ```kdl window-rule { match title="Firefox" match app-id="Alacritty" match is-active=true match is-focused=false match is-active-in-column=true match is-floating=true match is-window-cast-target=true match is-urgent=true match at-startup=true // Properties that apply once upon window opening. default-column-width { proportion 0.75; } default-window-height { fixed 500; } open-on-output "Some Company CoolMonitor 1234" open-on-workspace "chat" open-maximized true open-maximized-to-edges true open-fullscreen true open-floating true open-focused false // Properties that apply continuously. draw-border-with-background false opacity 0.5 block-out-from "screencast" // block-out-from "screen-capture" variable-refresh-rate true default-column-display "tabbed" default-floating-position x=100 y=200 relative-to="bottom-left" scroll-factor 0.75 focus-ring { // off on width 4 active-color "#7fc8ff" inactive-color "#505050" urgent-color "#9b0000" // active-gradient from="#80c8ff" to="#bbddff" angle=45 // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" // urgent-gradient from="#800" to="#a33" angle=45 } border { // Same as focus-ring. } shadow { // on off softness 40 spread 5 offset x=0 y=5 draw-behind-window true color "#00000064" // inactive-color "#00000064" } tab-indicator { active-color "red" inactive-color "gray" urgent-color "blue" // active-gradient from="#80c8ff" to="#bbddff" angle=45 // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" // urgent-gradient from="#800" to="#a33" angle=45 } geometry-corner-radius 12 clip-to-geometry true tiled-state true baba-is-float true background-effect { xray true blur true noise 0.05 saturation 3 } popups { opacity 0.5 geometry-corner-radius 15 background-effect { xray true blur true noise 0.05 saturation 3 } } min-width 100 max-width 200 min-height 300 max-height 300 } ``` -------------------------------- ### Match Layer Surface at Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Layer-Rules Apply rules only during the initial 60 seconds after Niri starts using the 'at-startup=true' matcher. This is useful for temporary startup configurations. ```kdl layer-rule { match at-startup=true opacity 0.5 } ``` -------------------------------- ### Start Niri from TTY Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md If not using a display manager, run 'niri-session' on a TTY to start Niri. This command is used for systemd/dinit systems. ```bash niri-session ``` -------------------------------- ### Full Output Configuration Example Source: https://github.com/niri-wm/niri/wiki/Configuration:-Outputs Demonstrates all available properties for configuring a specific output, including mode, scale, transform, position, variable refresh rate, focus, backdrop color, hot corners, and custom modes. ```kdl output "eDP-1" { // off mode "1920x1080@120.030" scale 2.0 transform "90" position x=1280 y=0 variable-refresh-rate // on-demand=true focus-at-startup backdrop-color "#001100" // max-bpc 8 hot-corners { // off top-left // top-right // bottom-left // bottom-right } layout { // ...layout settings for eDP-1... } // Custom modes. Caution: may damage your display. // mode custom=true "1920x1080@100" // modeline 173.00 1920 2048 2248 2576 1080 1083 1088 1120 "-hsync" "+vsync" } output "HDMI-A-1" { // ...settings for HDMI-A-1... } output "Some Company CoolMonitor 1234" { // ...settings for CoolMonitor... } ``` -------------------------------- ### Apply Rules at Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Window-Rules Configure rules that only apply during the first 60 seconds after Niri starts. This is useful for initial window placement or configuration, such as opening on a specific output. ```kdl // Open windows on the HDMI-A-1 monitor at niri startup, but not afterwards. window-rule { match at-startup=true open-on-output "HDMI-A-1" } ``` -------------------------------- ### Install Niri on Fedora with DankMaterialShell Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md Use these commands to install Niri and DankMaterialShell on Fedora for an out-of-the-box experience. Ensure you enable the necessary COPR repository first. ```bash sudo dnf copr enable avengemedia/dms sudo dnf install niri dms systemctl --user add-wants niri.service dms ``` -------------------------------- ### Configure Tablet Mode On Event Source: https://github.com/niri-wm/niri/wiki/Configuration:-Switch-Events Configure an action to execute when the device enters tablet mode. This example enables the on-screen keyboard using `gsettings`. ```kdl switch-events { tablet-mode-on { spawn "bash" "-c" "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true"; } } ``` -------------------------------- ### Comprehensive Window Rule Example Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Window-Rules.md Illustrates a wide range of matchers and properties available for window rule configuration, including opening behavior, appearance, and advanced settings like focus rings and shadows. ```kdl window-rule { match title="Firefox" match app-id="Alacritty" match is-active=true match is-focused=false match is-active-in-column=true match is-floating=true match is-window-cast-target=true match is-urgent=true match at-startup=true default-column-width { proportion 0.75; } default-window-height { fixed 500; } open-on-output "Some Company CoolMonitor 1234" open-on-workspace "chat" open-maximized true open-maximized-to-edges true open-fullscreen true open-floating true open-focused false draw-border-with-background false opacity 0.5 block-out-from "screencast" variable-refresh-rate true default-column-display "tabbed" default-floating-position x=100 y=200 relative-to="bottom-left" scroll-factor 0.75 focus-ring { on width 4 active-color "#7fc8ff" inactive-color "#505050" urgent-color "#9b0000" } border { } shadow { off softness 40 spread 5 offset x=0 y=5 draw-behind-window true color "#00000064" } tab-indicator { active-color "red" inactive-color "gray" urgent-color "blue" } geometry-corner-radius 12 clip-to-geometry true tiled-state true baba-is-float true background-effect { xray true blur true noise 0.05 saturation 3 } popups { opacity 0.5 geometry-corner-radius 15 background-effect { xray true blur true noise 0.05 saturation 3 } } min-width 100 max-width 200 min-height 300 max-height 300 } ``` -------------------------------- ### Install Ubuntu Dependencies for Niri Source: https://github.com/niri-wm/niri/wiki/Getting-Started Installs the necessary development libraries on Ubuntu 24.04 for building Niri. Ensure you have sudo privileges. ```sh sudo apt-get install -y gcc clang libudev-dev libgbm-dev libxkbcommon-dev libegl1-mesa-dev libwayland-dev libinput-dev libdbus-1-dev libsystemd-dev libseat-dev libpipewire-0.3-dev libpango1.0-dev libdisplay-info-dev ``` -------------------------------- ### Install Fedora Dependencies for Niri Source: https://github.com/niri-wm/niri/wiki/Getting-Started Installs the required development packages on Fedora for building Niri. Use this command with sudo privileges. ```sh sudo dnf install gcc libudev-devel libgbm-devel libxkbcommon-devel wayland-devel libinput-devel dbus-devel systemd-devel libseat-devel pipewire-devel pango-devel cairo-gobject-devel clang libdisplay-info-devel ``` -------------------------------- ### Window Rule Insertion Example Source: https://github.com/niri-wm/niri/wiki/Configuration:-Include Demonstrates how window rules from included files are inserted at the position of the 'include' directive, affecting the final order of rules. ```kdl // rules.kdl window-rule { match app-id="Alacritty" open-maximized false } ``` ```kdl // config.kdl window-rule { open-maximized true } // Window rules get inserted at this position. include "rules.kdl" window-rule { match app-id="firefox$" open-maximized true } ``` ```kdl window-rule { open-maximized true } // Included from rules.kdl. window-rule { match app-id="Alacritty" open-maximized false } window-rule { match app-id="firefox$" open-maximized true } ``` -------------------------------- ### Screen Mirroring Binding with wl-mirror Source: https://github.com/niri-wm/niri/wiki/Screencasting Configure a keybind to mirror the focused output to a window using wl-mirror. Requires wl-mirror and jq to be installed. Focus the desired output before triggering the bind. ```kdl binds { Mod+P repeat=false { spawn-sh "wl-mirror $(niri msg --json focused-output | jq -r .name)"; } } ``` -------------------------------- ### Install Niri on Arch Linux with DankMaterialShell Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md Install Niri and related packages for DankMaterialShell on Arch Linux. This includes Wayland utilities and a display manager. ```bash sudo pacman -Syu niri xwayland-satellite xdg-desktop-portal-gnome xdg-desktop-portal-gtk alacritty dms-shell-niri matugen cava qt6-multimedia-ffmpeg systemctl --user add-wants niri.service dms ``` -------------------------------- ### Set X11 Keymap using localectl Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Input.md Example of using the `localectl` command to set the X11 keymap. This command can also set TTY keymaps. ```sh $ localectl set-x11-keymap "us" "" "colemak_dh_ortho" "compose:ralt,ctrl:nocaps" ``` -------------------------------- ### Skip Hotkey Overlay at Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Miscellaneous Prevents the hotkey help overlay from appearing automatically when Niri starts. ```kdl hotkey-overlay { skip-at-startup } ``` -------------------------------- ### Configure window-close animation with duration and curve Source: https://github.com/niri-wm/niri/wiki/Configuration:-Animations Sets up a window closing animation with a specific duration and easing curve. 'ease-out-quad' is used in this example. ```kdl animations { window-close { duration-ms 150 curve "ease-out-quad" } } ``` -------------------------------- ### Configure Lid Close and Open Events Source: https://github.com/niri-wm/niri/wiki/Configuration:-Switch-Events Configure actions to be performed when the laptop lid is closed or opened. This example uses `notify-send` to display a message. ```kdl switch-events { lid-close { spawn "notify-send" "The laptop lid is closed!"; } lid-open { spawn "notify-send" "The laptop lid is open!"; } } ``` -------------------------------- ### Spawn Shell Commands at Niri Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Miscellaneous Execute shell commands when Niri starts. The command string is passed directly to `sh`, allowing shell features like variables and pipelines. ```kdl spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" ``` -------------------------------- ### Add Services to Niri Session Source: https://github.com/niri-wm/niri/wiki/Example-systemd-Setup Use `systemctl --user add-wants` to link services like mako and waybar to the niri session. This ensures they start with Niri and are managed by its service. ```bash systemctl --user add-wants niri.service mako.service systemctl --user add-wants niri.service waybar.service ``` -------------------------------- ### Control dynamic screencast target from command line Source: https://github.com/niri-wm/niri/wiki/Screencasting Interact with the dynamic screencast target using `niri msg action` to set the window or monitor to be cast. This example shows how to pick a window interactively. ```sh $ niri msg action set-dynamic-cast-window --id $(niri msg --json pick-window | jq .id) ``` -------------------------------- ### Get Niri version Source: https://github.com/niri-wm/niri/wiki/Packaging-niri Display the current Niri version, including the version number and commit hash. This command is useful for verifying the installed version. ```bash niri --version ``` -------------------------------- ### Example of niri msg --json command Source: https://github.com/niri-wm/niri/wiki/IPC Use the `--json` flag with `niri msg` to get responses in JSON format, which is suitable for scripting and programmatic parsing. ```sh niri msg --json outputs ``` -------------------------------- ### Override Niri version string Source: https://github.com/niri-wm/niri/wiki/Packaging-niri Override the entire version string for Niri builds, for example, to include packaging information. Ensure the base Niri version remains intact. This variable should be set for both `cargo build` and `cargo install`. ```bash export NIRI_BUILD_VERSION_STRING="25.01-1 (e35c630)" ...proceed to build niri ``` -------------------------------- ### Basic Window Rule Configuration Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Window-Rules.md Demonstrates setting a global rule to open all windows maximized, followed by a specific rule to override this for Alacritty. ```kdl window-rule { open-maximized true } window-rule { match app-id="Alacritty" open-maximized false } ``` -------------------------------- ### Serve Documentation Locally with uv Source: https://github.com/niri-wm/niri/wiki/Development:-Documenting-niri Use uv to synchronize dependencies and serve the documentation site locally. Changes will trigger automatic browser refreshes. ```bash uv sync ``` ```bash uv run mkdocs serve ``` -------------------------------- ### Serve Documentation Site Locally Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Development:-Documenting-niri.md Run mkdocs serve in the docs/ subdirectory to serve the documentation site locally. Changes will auto-refresh. ```bash uv sync uv run mkdocs serve ``` -------------------------------- ### Example GitHub Flavored Markdown Admonition Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Development:-Documenting-niri.md Admonitions should be written using GitHub's defined alert syntax. This example shows an IMPORTANT alert. ```markdown > [!IMPORTANT] > This is an important distinction from other `mkdocs`-based documentation you might have encountered. ``` -------------------------------- ### Kick off COPR Build Source: https://github.com/niri-wm/niri/wiki/Development:-Releasing-niri Initiate a new build in the COPR repository using the `copr-cli` tool. This can also be done via the COPR web interface. ```bash copr-cli build niri niri.spec ``` -------------------------------- ### Take Screenshots with screenshot Actions Source: https://github.com/niri-wm/niri/wiki/Configuration:-Key-Bindings Use `screenshot`, `screenshot-screen`, and `screenshot-window` for taking screenshots. Options like `write-to-disk=false` and `show-pointer=true/false` customize the behavior. ```kdl binds { Ctrl+Print { screenshot-screen write-to-disk=false; } Alt+Print { screenshot-window write-to-disk=false; } } ``` ```kdl binds { // The pointer will be hidden by default // (you can still show it by pressing P). Print { screenshot show-pointer=false; } // The pointer will be hidden on the screenshot. Ctrl+Print { screenshot-screen show-pointer=false; } } ``` ```kdl binds { // The pointer will be visible on the screenshot // if it's on top of the window. Alt+Print { screenshot-window show-pointer=true; } } ``` -------------------------------- ### Run X11 client with xwayland-run Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Xwayland.md Use xwayland-run to launch an X11 client within a dedicated Xwayland server. It handles Xwayland startup, DISPLAY variable, xauth setup, and client execution, automatically closing Xwayland when the client exits. ```bash xwayland-run -- your-x11-app ``` -------------------------------- ### Disable a Flag in KDL Source: https://github.com/niri-wm/niri/wiki/Configuration:-Introduction To disable a flag, comment it out or omit it. This example shows 'focus-follows-mouse' being disabled. ```kdl // "Focus follows mouse" is disabled. input { // focus-follows-mouse // Other settings... } ``` -------------------------------- ### Stop Waybar Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Getting-Started.md If you have two bars on screen after installation, stop the duplicate Waybar process using this command. ```bash pkill waybar ``` -------------------------------- ### Build Niri with specific features Source: https://github.com/niri-wm/niri/wiki/Packaging-niri Replace systemd integration with dinit integration and enable dbus and xdp-gnome-screencast features when building Niri. Ensure to avoid building with `--all-features` as some features are for development only. ```bash cargo build --release --no-default-features --features dinit,dbus,xdp-gnome-screencast ``` -------------------------------- ### Spawn Action: Argument Separation Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Key-Bindings.md Demonstrates correct and incorrect ways to pass arguments to the 'spawn' action. Each argument should be a separate string. ```kdl binds { // Correct: every argument is in its own quotes. Mod+T { spawn "alacritty" "-e" "/usr/bin/fish"; } // Wrong: will interpret the whole `alacritty -e /usr/bin/fish` string as the binary path. Mod+D { spawn "alacritty -e /usr/bin/fish"; } // Wrong: will pass `-e /usr/bin/fish` as one argument, which alacritty won't understand. Mod+Q { spawn "alacritty" "-e /usr/bin/fish"; } } ``` -------------------------------- ### Configure All Switch Events Source: https://github.com/niri-wm/niri/wiki/Configuration:-Switch-Events This snippet shows the complete configuration for all available switch events: lid close, lid open, tablet mode on, and tablet mode off. It uses the `spawn` action to execute commands when these events occur. ```kdl switch-events { lid-close { spawn "notify-send" "The laptop lid is closed!"; } lid-open { spawn "notify-send" "The laptop lid is open!"; } tablet-mode-on { spawn "bash" "-c" "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true"; } tablet-mode-off { spawn "bash" "-c" "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false"; } } ``` -------------------------------- ### Define Struts in KDL Source: https://github.com/niri-wm/niri/wiki/Configuration:-Include Example of defining left and right struts within a layout in a KDL configuration file. ```kdl // struts.kdl layout { struts { left 64 right 64 } } ``` -------------------------------- ### Invalid Section Repetition in KDL Source: https://github.com/niri-wm/niri/wiki/Configuration:-Introduction This example demonstrates an invalid configuration where the 'input' section is repeated, which is not allowed for most sections. ```kdl // This is NOT valid: input section appears twice. input { keyboard { // ... } } input { touchpad { // ... } } ``` -------------------------------- ### Include Paths Source: https://github.com/niri-wm/niri/wiki/Configuration:-Include Demonstrates different ways to specify paths for included files: relative to the current file, by absolute path, or using home directory expansion. ```kdl include "other.kdl" ``` ```kdl include "./other.kdl" ``` ```kdl include "/path/to/file.kdl" ``` ```kdl include "~/file.kdl" ``` -------------------------------- ### Add systemd Dependency for plasma-polkit-agent Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Important-Software.md Add the 'After=graphical-session.target' line to the plasma-polkit-agent.service file to ensure it starts after the graphical session is ready. ```systemd After=graphical-session.target ``` -------------------------------- ### Disable Primary Clipboard Source: https://github.com/niri-wm/niri/wiki/Configuration:-Miscellaneous Disables the primary clipboard (middle-click paste). This change only affects applications started after the setting is applied. ```kdl clipboard { disable-primary } ``` -------------------------------- ### Include Paths Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Configuration:-Include.md Demonstrates different ways to specify paths for included files: relative to the current file, absolute paths, and home directory paths. ```kdl // Relative to the current file: `other.kdl` or `./other.kdl` // By absolute path: `/path/to/file.kdl` // Home dir paths: `~/file.kdl` expands to `/home/user/file.kdl` ``` -------------------------------- ### Auto-Hide Cursor After Inactivity Source: https://github.com/niri-wm/niri/wiki/Configuration:-Miscellaneous Automatically hides the cursor after a specified number of milliseconds of inactivity. Example hides cursor after 1 second. ```kdl cursor { // Hide the cursor after one second of inactivity. hide-after-inactive-ms 1000 } ``` -------------------------------- ### Build and Run Niri with Nix Source: https://github.com/niri-wm/niri/wiki/Getting-Started Builds Niri using a Nix flake and then runs the resulting binary. This command assumes you are using Nix and have the flake available. ```sh nix build ``` -------------------------------- ### Enable a Flag in KDL Source: https://github.com/niri-wm/niri/wiki/Configuration:-Introduction Flags are used to toggle options. Writing out the flag name enables it. This example shows how to enable 'focus-follows-mouse'. ```kdl // "Focus follows mouse" is enabled. input { focus-follows-mouse // Other settings... } ``` -------------------------------- ### Configure Workspace with Output Source: https://github.com/niri-wm/niri/wiki/Configuration:-Named-Workspaces Declare a named workspace and specify the output it should initially open on. This is useful for assigning specific monitors to workspaces. ```kdl // Declare a workspace named "chat" that opens on the "DP-2" output. workspace "chat" { open-on-output "DP-2" } // Open Fractal on the "chat" workspace, if it runs at niri startup. window-rule { match at-startup=true app-id=r$"^org\\.gnome\\.Fractal$"$ open-on-workspace "chat" } ``` -------------------------------- ### Flag Disabling Example Source: https://github.com/niri-wm/niri/wiki/Configuration:-Include Flags can often be disabled by setting them to 'false'. Including a file that sets a flag to false will override its previous definition. ```kdl // csd.kdl // Write "false" to explicitly disable. prefer-no-csd false ``` ```kdl // config.kdl // Enable prefer-no-csd in the main config. prefer-no-csd // Including csd.kdl will disable it again. include "csd.kdl" ``` -------------------------------- ### Run X11 App with xwayland-run Source: https://github.com/niri-wm/niri/wiki/Xwayland Use xwayland-run to launch an X11 client within a dedicated Xwayland server. It manages Xwayland startup, DISPLAY variable, xauth, and client execution, automatically closing Xwayland when the client exits. ```bash xwayland-run -- your-x11-app ``` ```bash xwayland-run -geometry 800x600 -fullscreen -- wine wingame.exe ``` -------------------------------- ### Set Output Focus on Startup Source: https://github.com/niri-wm/niri/wiki/Configuration:-Outputs Designate an output to receive focus by default when Niri WM starts. If multiple outputs are marked, the one appearing first in the configuration takes priority. If none are marked, the first output sorted by name is focused. ```kdl // Focus HDMI-A-1 by default. output "HDMI-A-1" { focus-at-startup } // ...if HDMI-A-1 wasn't connected, focus DP-2 instead. output "DP-2" { focus-at-startup } ``` -------------------------------- ### Display Niri Version Source: https://github.com/niri-wm/niri/blob/main/docs/wiki/Packaging-niri.md Check the current version and commit hash of the Niri build. This command shows the installed version and its corresponding git commit. ```bash $ niri --version ``` -------------------------------- ### Download Source Files for RPM Build Source: https://github.com/niri-wm/niri/wiki/Development:-Releasing-niri Download the source files required for building the RPM package using `spectool`. This is typically done before running `fedpkg mockbuild`. ```bash spectool -g niri.spec ``` -------------------------------- ### Configure Tablet Mode Off Event Source: https://github.com/niri-wm/niri/wiki/Configuration:-Switch-Events Configure an action to execute when the device exits tablet mode. This example disables the on-screen keyboard using `gsettings`. ```kdl switch-events { tablet-mode-off { spawn "bash" "-c" "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false"; } } ``` -------------------------------- ### Positional Override Example Source: https://github.com/niri-wm/niri/wiki/Configuration:-Include Illustrates how includes are positional. Settings in an included file override settings defined before it, and settings after the include can override those from the included file. ```kdl // colors.kdl layout { border { active-color "green" } } overview { backdrop-color "green" } ``` ```kdl // config.kdl layout { border { active-color "red" } } // This overrides the border color and the backdrop color to green. include "colors.kdl" // This sets the overview backdrop color to red again. overview { backdrop-color "red" } ``` -------------------------------- ### Run Niri via NixGL Source: https://github.com/niri-wm/niri/wiki/Getting-Started Executes the Niri binary using NixGL, which is recommended for running Nix-built binaries on non-NixOS systems. Ensure NixGL is installed. ```sh nix run --impure github:guibou/nixGL -- ./results/bin/niri ``` -------------------------------- ### Build Niri with Tracy Profiling (On-Demand) Source: https://github.com/niri-wm/niri/wiki/Developing-niri Enable on-demand profiling with the Tracy profiler by building Niri with the `profile-with-tracy-ondemand` feature flag. This allows attaching Tracy to a running Niri instance to collect profiling data. ```bash cargo build --release --features=profile-with-tracy-ondemand ```