Niri: Difference between revisions

m Fixed typo: may unable -> may be unable
Add example on build-time validation
 
(26 intermediate revisions by 15 users not shown)
Line 1: Line 1:
<languages/>
{{DISPLAYTITLE:niri}}
{{infobox application
{{infobox application
  |name=Niri
| name = niri
  |type=Wayland compositor
| type = Wayland compositor
  |initialRelease=2023-11-26
| initialRelease = 2023-11-26
  |status=Active
| status = Active
  |license=GNU General Public License v3.0 only
| license = GNU General Public License v3.0 only
  |os=Linux, FreeBSD
| os = Linux, FreeBSD
  |programmingLanguage=Rust, GLSL
| programmingLanguage = Rust, GLSL
  |github=YaLTeR/niri
| github = niri-wm/niri
  |documentation=[https://github.com/YaLTeR/niri/wiki Official wiki], [https://github.com/sodiboo/niri-flake/blob/main/docs.md niri-flake]
| documentation = [https://niri-wm.github.io/niri/ Official wiki], [https://github.com/sodiboo/niri-flake/blob/main/docs.md niri-flake]
| image = Niri-icon.svg
| bugTracker = https://github.com/niri-wm/niri/issues
| latestRelease = 26.04; 25 Apr 2026
}}
}}
<translate>


[https://github.com/YaLTeR/niri Niri] is a scrollable-tiling [[Wayland]] compositor.
<!--T:1-->
[<tvar name="1">https://github.com/niri-wm/niri</tvar> Niri] is a scrollable-tiling [[<tvar name="2">Special:MyLanguage/Wayland</tvar>|Wayland]] compositor.


== Installation ==
== Installation == <!--T:2-->


<!--T:3-->
Simply enable {{nixos:option|programs.niri}}:
Simply enable {{nixos:option|programs.niri}}:


</translate>
{{file|/etc/nixos/configuration.nix|nix|3=
{{file|/etc/nixos/configuration.nix|nix|3=
programs.niri.enable = true;
programs.niri.enable = true;
}}
}}


{{Note|Niri can be enabled <strong>without installing a custom flake</strong> such as [https://github.com/sodiboo/niri-flake niri-flake]. {{ic|niri-flake}} is only necessary if you want to use a very recent version of Niri or if you want to write configurations in the Nix language, although as of 2025 this repository is listed near the top in search engines.}}
{{Note|<translate><!--T:4--> Niri can be enabled <strong>without installing a custom flake</strong> such as [<tvar name="1">https://github.com/sodiboo/niri-flake</tvar> niri-flake]. {{ic|niri-flake}} is only necessary if you would like to use a very recent version of Niri or if you would want to write configurations in the Nix language, although as of 2025 this repository is listed near the top in search engines.</translate>}}


{{Warning|Without [[#Configuration]] or [[#Additional Setup]], or in other words after fresh installation, you may be unable to launch apps because of missing Alacritty and fuzzel. Press <kbd>Super</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> to exit Niri and proceed to one of them.}}


== Configuration ==
{{Warning|<translate><!--T:5--> Without [[<tvar name="1">#Configuration</tvar>|Configuration]] or [[<tvar name="2">#Additional Setup</tvar>|Additional Setup]], or after a fresh installation, you may be unable to launch apps due to missing expected programs such as Alacritty and fuzzel. Press <kbd>Super</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> to exit niri and proceed to one of them.</translate>}}


The configuration path for Niri is {{ic|$XDG_CONFIG_HOME/niri/config.kdl}}. Therefore [[Home Manager]] can be used for configuration:
<translate>


== Configuration == <!--T:6-->
<!--T:7-->
The configuration path for niri is {{ic|$XDG_CONFIG_HOME/niri/config.kdl}}. Therefore [[<tvar name="1">Special:MyLanguage/Home Manager</tvar>|Home Manager]] can be used for configuration:
</translate>
{{file|~/.config/home-manager/home.nix|nix|3=
{{file|~/.config/home-manager/home.nix|nix|3=
xdg.configFile."niri/config.kdl".source = ./config.kdl;
xdg.configFile."niri/config.kdl".source = ./config.kdl;
}}
}}
<translate>
If you want to validate your configuration as part of the build process you can use {{ic|pkgs.runCommand}} like this:
</translate>
{{file|~/.config/home-manager/home.nix|nix|3=
xdg.configFile."niri/config.kdl".source =
  pkgs.runCommand "niri-config-checked"
    {
      nativeBuildInputs = [ pkgs.niri ];
    }
    ''
      niri validate --config ${./config.kdl}
      cp ${./config.kdl} $out
    '';
}}
<translate>
<!--T:8-->
You might want to start from [<tvar name="1">https://github.com/niri-wm/niri/blob/main/resources/default-config.kdl</tvar> the default configuration file] described at [<tvar name="2">https://github.com/niri-wm/niri/wiki/Getting-Started#main-default-hotkeys</tvar> here].
<!--T:9-->
See [<tvar name="1">https://niri-wm.github.io/niri/</tvar> the wiki] for configuration options for niri.
=== Greetd === <!--T:10-->
<!--T:11-->
You can start niri with greetd configuration:
</translate>
{{file|/etc/nixos/configuration.nix|nix|3=
programs.niri.enable = true;
services.greetd = {
  enable = true;
  settings = {
    default_session = {
      command = "${config.programs.niri.package}/bin/niri-session";
      user = "myuser";
    };
  };
};


You might want to start from [https://github.com/YaLTeR/niri/blob/main/resources/default-config.kdl the default configuration file] described at [https://github.com/YaLTeR/niri/wiki/Getting-Started#main-default-hotkeys].
# NixOS otherwise injects a stripped PATH via Environment= on the niri.service
# unit which shadows the imported user-manager PATH. Disabling the default
# lets niri inherit the full PATH set up by niri-session.
systemd.user.services.niri.enableDefaultPath = false;


See [https://github.com/YaLTeR/niri/wiki the wiki] for configuration options for Niri.
}}


== Additional Setup ==
<translate>
== Additional Setup == <!--T:12-->


As described in [https://github.com/YaLTeR/niri/wiki/Example-systemd-Setup Example systemd Setup (Niri wiki)], you might want to set up some additional services including [[Swayidle]], [[Swaylock]], [[Waybar]], [[Polkit]] and [[Secret Service]] as follows to complement the functionality of a regular window manager. Some of the these settings are also required to enable all the features of [https://github.com/YaLTeR/niri/blob/main/resources/default-config.kdl the default configuration file].
<!--T:13-->
As described in [<tvar name=1>https://github.com/niri-wm/niri/wiki/Example-systemd-Setup</tvar> Example systemd Setup (niri wiki)], you might want to set up some additional services including [[<tvar name=2>Special:MyLanguage/Swayidle</tvar>|Swayidle]], [[<tvar name=3>Special:MyLanguage/Swaylock</tvar>|Swaylock]], [[<tvar name=4>Special:MyLanguage/Waybar</tvar>|Waybar]], [[<tvar name=5>Special:MyLanguage/Polkit</tvar>|Polkit]] and [[<tvar name=6>Special:MyLanguage/Secret Service</tvar>|Secret Service]] as follows to complement the functionality of a regular window manager. Some of the these settings are also required to enable all the features of [<tvar name=7>https://github.com/niri-wm/niri/blob/main/resources/default-config.kdl</tvar> the default configuration file].
</translate>


{{file|3=
{{file|3=
Line 47: Line 109:


programs.waybar.enable = true; # top bar
programs.waybar.enable = true; # top bar
environment.systemPackages = with pkgs; [ alacritty fuzzel swaylock mako swayidle ]
environment.systemPackages = with pkgs; [ alacritty fuzzel swaylock mako swayidle ];
|name=/etc/nixos/configuration.nix|lang=nix}}Or using [[Home Manager]]:{{file|~/.config/home-manager/home.nix|nix|3=
|name=/etc/nixos/configuration.nix|lang=nix}}
 
<translate>
<!--T:14-->
Or using [[<tvar name=1>Special:MyLanguage/Home Manager</tvar>|Home Manager]]:
</translate>
 
{{file|~/.config/home-manager/home.nix|nix|3=
programs.alacritty.enable = true; # Super+T in the default setting (terminal)
programs.alacritty.enable = true; # Super+T in the default setting (terminal)
programs.fuzzel.enable = true; # Super+D in the default setting (app launcher)
programs.fuzzel.enable = true; # Super+D in the default setting (app launcher)
Line 61: Line 130:
|name=~/.config/home-manager/home.nix|lang=nix}}
|name=~/.config/home-manager/home.nix|lang=nix}}


== Troubleshooting ==
<translate>
== Troubleshooting == <!--T:15-->


=== IME not working on Electron apps ===
=== IME not working on Electron apps === <!--T:16-->


There is a general workaround to set {{ic|NIXOS_OZONE_WL}} as described in [[Wayland#Electron_and_Chromium]]:
<!--T:17-->
There is a general workaround to set {{ic|NIXOS_OZONE_WL}} as described in [[<tvar name=1>Special:MyLanguage/Wayland#Electron_and_Chromium</tvar>|Wayland#Electron_and_Chromium]]:
</translate>


{{file|/etc/nixos/configuration.nix|nix|3=
{{file|/etc/nixos/configuration.nix|nix|3=
Line 71: Line 143:
}}
}}


However, since Niri does not support text-input-v1, sometimes enabling text-input-v3 by manually adding {{ic|<nowiki>--wayland-text-input-version=3</nowiki>}} flag is necessary for IME to work:
<translate>
<!--T:18-->
However, since niri does not support text-input-v1, sometimes enabling text-input-v3 by manually adding {{ic|<nowiki>--wayland-text-input-version=3</nowiki>}} flag is necessary for IME to work:
</translate>


{{code|<nowiki>slack --wayland-text-input-version=3</nowiki>}}
<syntaxhighlight lang=console>
$ slack --wayland-text-input-version=3
</syntaxhighlight>


Alternatively, if the package supports {{ic|commandLineArgs}}, the following may be used instead:
<translate>
<!--T:19-->
<code>wrapProgram</code> may be used to add the flag automatically:
</translate>


{{code|<nowiki>(pkgs.vscode.override {
{{file|/etc/nixos/configuration.nix|nix|3=
  commandLineArgs = [
environment.systemPackages = [
     "--wayland-text-input-version=3"
  (pkgs.symlinkJoin {
   ];
    pname = pkgs.vscode.pname;
});</nowiki>}}
    paths = [ pkgs.vscode ];
    buildInputs = [ pkgs.makeWrapper ];
     postBuild = "wrapProgram $out/bin/code --add-flags --wayland-text-input-version=3";
   };)
];}}


=== XWayland apps not working ===
<translate>
There is a optional dependency for Niri which is highly recommended to install (you can read [https://github.com/YaLTeR/niri/wiki/Xwayland this] article to learn more about this)
=== XWayland apps not working === <!--T:20-->
 
<!--T:21-->
There is a optional dependency for niri which is highly recommended to install (you can read [<tvar name=1>https://github.com/niri-wm/niri/wiki/Xwayland</tvar> this] article to learn more about this)
</translate>


{{File|3=environment.systemPackages = with pkgs; [  
{{File|3=environment.systemPackages = with pkgs; [  
     xwayland-satellite # xwayland support
     xwayland-satellite # xwayland support
];|name=❄︎ /etc/nixos/configuration.nix|lang=Nix}}
];|name=/etc/nixos/configuration.nix|lang=nix}}


Or using [[Home Manager]]
<translate>
<!--T:22-->
Or using [[<tvar name=1>Special:MyLanguage/Home Manager</tvar>|Home Manager]]
</translate>


{{File|3=home.packages = with pkgs; [
{{File|3=home.packages = with pkgs; [
   xwayland-satellite # xwayland support
   xwayland-satellite # xwayland support
];|name=❄︎ ~/.config/home-manager/home.nix|lang=Nix}}
];|name=~/.config/home-manager/home.nix|lang=nix}}
 
<translate>
<!--T:23-->
After you installed {{ic|xwayland-satellite}} niri will integrate it out of the box and all of your XWayland apps will function properly.
 
=== File picker not working === <!--T:24-->
 
<!--T:25-->
If you are using <code>xdg-desktop-portal-gnome</code>, it will attempt to use Nautilus as the file picker, which will fail if Nautilus is not installed.
 
<!--T:26-->
To work around this problem, you can force usage of the gtk or kde portals for file picker instead:
</translate>
 
{{File|3=xdg.portal.config.niri = {
  "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; # or "kde"
};|name=/etc/nixos/configuration.nix|lang=nix}}
 
<translate>
=== Waybar launches twice === <!--T:27-->


After you installed {{ic|xwayland-satellite}} Niri will integrate it out of the box and all of your XWayland apps will function properly.
<!--T:28-->
When using a configuration option like programs.waybar.enable, waybar may launch twice on Niri. This is because the [<tvar name=1>https://github.com/niri-wm/niri/blob/b07bde3ee82dd73115e6b949e4f3f63695da35ea/resources/default-config.kdl#L271</tvar> default Niri config file launches waybar on launch]. Remove the spawn-at-startup "waybar" from the config file, or add waybar to your systems packages without using the home-manager option.


== See Also ==
== See Also == <!--T:29-->


* [[Wayland]]
<!--T:30-->
* [[Sway]]
* [[<tvar name=1>Special:MyLanguage/Wayland</tvar>|Wayland]]
* [[Wallpapers for Wayland]]
* [[<tvar name=2>Special:MyLanguage/Sway</tvar>|Sway]]
* [https://github.com/sodiboo/niri-flake/ niri-flake]
* [[<tvar name=3>Special:MyLanguage/Wallpapers for Wayland</tvar>|Wallpapers for Wayland]]
* [<tvar name=4>https://github.com/sodiboo/niri-flake/</tvar> niri-flake]
</translate>


[[Category:Window managers]]
[[Category:Window managers]]
[[Category:Applications]]
[[Category:Applications{{#translation:}}]]