Jump to content

Niri: Difference between revisions

From Official NixOS Wiki
Ardenet (talk | contribs)
Adjust the position of page translation tags
Ardenet (talk | contribs)
Marked this version for translation
 
(One intermediate revision by the same user not shown)
Line 17: Line 17:
<translate>
<translate>


[https://github.com/niri-wm/niri Niri] is a scrollable-tiling [[Special:MyLanguage/Wayland|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}}:


Line 28: Line 30:
}}
}}


{{Note|<translate>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 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>}}
{{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|<translate>Without [[#Configuration|Configuration]] or [[#Additional Setup|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>}}
{{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>}}


<translate>
<translate>


== Configuration ==
== Configuration == <!--T:6-->


The configuration path for niri is {{ic|$XDG_CONFIG_HOME/niri/config.kdl}}. Therefore [[Special:MyLanguage/Home Manager|Home Manager]] can be used for configuration:
<!--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>
</translate>
Line 45: Line 48:
<translate>
<translate>


You might want to start from [https://github.com/niri-wm/niri/blob/main/resources/default-config.kdl the default configuration file] described at [https://github.com/niri-wm/niri/wiki/Getting-Started#main-default-hotkeys].
<!--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].


See [https://niri-wm.github.io/niri/ the wiki] for configuration options for niri.
<!--T:9-->
See [<tvar name="1">https://niri-wm.github.io/niri/</tvar> the wiki] for configuration options for niri.


=== Greetd ===
=== Greetd === <!--T:10-->


<!--T:11-->
You can start niri with greetd configuration:
You can start niri with greetd configuration:


Line 75: Line 81:


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


As described in [https://github.com/niri-wm/niri/wiki/Example-systemd-Setup Example systemd Setup (niri wiki)], you might want to set up some additional services including [[Special:MyLanguage/Swayidle|Swayidle]], [[Special:MyLanguage/Swaylock|Swaylock]], [[Special:MyLanguage/Waybar|Waybar]], [[Special:MyLanguage/Polkit|Polkit]] and [[Special:MyLanguage/Secret Service|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/niri-wm/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>
</translate>


Line 90: Line 97:


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


Line 107: Line 115:


<translate>
<translate>
== Troubleshooting ==
== 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 [[Special:MyLanguage/Wayland#Electron_and_Chromium|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>
</translate>


Line 119: Line 128:


<translate>
<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:
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>
</translate>
Line 127: Line 137:


<translate>
<translate>
<!--T:19-->
<code>wrapProgram</code> may be used to add the flag automatically:
<code>wrapProgram</code> may be used to add the flag automatically:
</translate>
</translate>
Line 141: Line 152:


<translate>
<translate>
=== XWayland apps not working ===
=== XWayland apps not working === <!--T:20-->


There is a optional dependency for niri which is highly recommended to install (you can read [https://github.com/niri-wm/niri/wiki/Xwayland this] article to learn more about this)
<!--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>
</translate>


Line 151: Line 163:


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


Line 159: Line 172:


<translate>
<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.
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 ===
=== 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.
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:
To work around this problem, you can force usage of the gtk or kde portals for file picker instead:
</translate>
</translate>
Line 173: Line 189:


<translate>
<translate>
=== Waybar launches twice ===
=== Waybar launches twice === <!--T:27-->


When using a configuration option like programs.waybar.enable, waybar may launch twice on Niri. This is because the [https://github.com/niri-wm/niri/blob/b07bde3ee82dd73115e6b949e4f3f63695da35ea/resources/default-config.kdl#L271 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.
<!--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-->


* [[Special:MyLanguage/Wayland|Wayland]]
<!--T:30-->
* [[Special:MyLanguage/Sway|Sway]]
* [[<tvar name=1>Special:MyLanguage/Wayland</tvar>|Wayland]]
* [[Special:MyLanguage/Wallpapers for 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>
</translate>


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

Latest revision as of 16:36, 31 May 2026

niri

Wayland compositor Application

100%
Initial release2023-11-26
Latest release26.04; 25 Apr 2026
StatusActive
Operating SystemLinux, FreeBSD
Language(s)Rust, GLSL
LicenseGNU General Public License v3.0 only
External links
GitHubniri-wm/niri
Bug trackerhttps://github.com/niri-wm/niri/issues
DocumentationOfficial wiki, niri-flake

Niri is a scrollable-tiling Wayland compositor.

Installation

Simply enable programs.niri:

❄︎ /etc/nixos/configuration.nix
programs.niri.enable = true;
Note: Niri can be enabled without installing a custom flake such as niri-flake. 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.


⚠︎
Warning: Without Configuration or 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 Super+Shift+E to exit niri and proceed to one of them.


Configuration

The configuration path for niri is $XDG_CONFIG_HOME/niri/config.kdl. Therefore Home Manager can be used for configuration:

❄︎ ~/.config/home-manager/home.nix
xdg.configFile."niri/config.kdl".source = ./config.kdl;

You might want to start from the default configuration file described at here.

See the wiki for configuration options for niri.

Greetd

You can start niri with greetd configuration:

❄︎ /etc/nixos/configuration.nix
programs.niri.enable = true;

services.greetd = {
  enable = true;
  settings = {
    default_session = {
      command = "${config.programs.niri.package}/bin/niri-session";
      user = "myuser";
    };
  };
};

# 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;

Additional Setup

As described in 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 the default configuration file.

❄︎ /etc/nixos/configuration.nix
security.polkit.enable = true; # polkit
services.gnome.gnome-keyring.enable = true; # secret service
security.pam.services.swaylock = {};

programs.waybar.enable = true; # top bar
environment.systemPackages = with pkgs; [ alacritty fuzzel swaylock mako swayidle ];

Or using Home Manager:

❄︎ ~/.config/home-manager/home.nix
programs.alacritty.enable = true; # Super+T in the default setting (terminal)
programs.fuzzel.enable = true; # Super+D in the default setting (app launcher)
programs.swaylock.enable = true; # Super+Alt+L in the default setting (screen locker)
programs.waybar.enable = true; # launch on startup in the default setting (bar)
services.mako.enable = true; # notification daemon
services.swayidle.enable = true; # idle management daemon
services.polkit-gnome.enable = true; # polkit
home.packages = with pkgs; [
  swaybg # wallpaper
];

Troubleshooting

IME not working on Electron apps

There is a general workaround to set NIXOS_OZONE_WL as described in Wayland#Electron_and_Chromium:

❄︎ /etc/nixos/configuration.nix
environment.sessionVariables.NIXOS_OZONE_WL = "1";

However, since niri does not support text-input-v1, sometimes enabling text-input-v3 by manually adding --wayland-text-input-version=3 flag is necessary for IME to work:

$ slack --wayland-text-input-version=3

wrapProgram may be used to add the flag automatically:

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

XWayland apps not working

There is a optional dependency for niri which is highly recommended to install (you can read this article to learn more about this)

❄︎ /etc/nixos/configuration.nix
environment.systemPackages = with pkgs; [ 
    xwayland-satellite # xwayland support
];

Or using Home Manager

❄︎ ~/.config/home-manager/home.nix
home.packages = with pkgs; [
  xwayland-satellite # xwayland support
];

After you installed xwayland-satellite niri will integrate it out of the box and all of your XWayland apps will function properly.

File picker not working

If you are using xdg-desktop-portal-gnome, it will attempt to use Nautilus as the file picker, which will fail if Nautilus is not installed.

To work around this problem, you can force usage of the gtk or kde portals for file picker instead:

❄︎ /etc/nixos/configuration.nix
xdg.portal.config.niri = {
  "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; # or "kde"
};

Waybar launches twice

When using a configuration option like programs.waybar.enable, waybar may launch twice on Niri. This is because the 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