Niri: Difference between revisions
m Minor update to Niri's version and a website link. |
m →Configuration: update link (yalter -> niri-wm) in one more place |
||
| (One intermediate revision by the same user not shown) | |||
| Line 16: | Line 16: | ||
<translate> | <translate> | ||
[https://github.com/ | [https://github.com/niri-wm/niri Niri] is a scrollable-tiling [[Wayland]] compositor. | ||
== Installation == | == Installation == | ||
| Line 42: | Line 42: | ||
<translate> | <translate> | ||
You might want to start from [https://github.com/ | 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]. | ||
See [https:// | See [https://niri-wm.github.io/niri/ the wiki] for configuration options for niri. | ||
=== Greetd === | === Greetd === | ||
You can start | You can start niri with greetd configuration: | ||
{{file|/etc/nixos/configuration.nix|nix|3= | {{file|/etc/nixos/configuration.nix|nix|3= | ||
| Line 68: | Line 68: | ||
systemd.user.services.niri.enableDefaultPath = false; | systemd.user.services.niri.enableDefaultPath = false; | ||
}} | |||
== Additional Setup == | == Additional Setup == | ||
As described in [https://github.com/ | 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 [[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/niri-wm/niri/blob/main/resources/default-config.kdl the default configuration file]. | ||
</translate> | </translate> | ||
| Line 111: | Line 111: | ||
</translate> | </translate> | ||
<syntaxhighlight lang=console> | |||
$ slack --wayland-text-input-version=3 | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
| Line 130: | Line 132: | ||
=== XWayland apps not working === | === XWayland apps not working === | ||
There is a optional dependency for niri which is highly recommended to install (you can read [https://github.com/ | 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) | ||
</translate> | </translate> | ||
Latest revision as of 22:17, 20 May 2026
Niri is a scrollable-tiling Wayland compositor.
Installation
Simply enable programs.niri:
programs.niri.enable = true;
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.Configuration
The configuration path for niri is $XDG_CONFIG_HOME/niri/config.kdl. Therefore Home Manager can be used for configuration:
xdg.configFile."niri/config.kdl".source = ./config.kdl;
You might want to start from the default configuration file described at [1].
See the wiki for configuration options for niri.
Greetd
You can start niri with greetd configuration:
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.
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:
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:
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:
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)
environment.systemPackages = with pkgs; [
xwayland-satellite # xwayland support
];
Or using Home Manager
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:
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.