Jump to content

Niri: Difference between revisions

From NixOS Wiki
34j (talk | contribs)
mNo edit summary
Axka (talk | contribs)
m Typo + keyboard shortcut with <kbd> element
 
(14 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[https://github.com/YaLTeR/niri Niri] is a scrollable tiling [[Wayland]] compositor.
{{infobox application
  |name=Niri
  |type=Wayland compositor
  |initialRelease=2023-11-26
  |status=Active
  |license=GNU General Public License v3.0 only
  |os=Linux, FreeBSD
  |programmingLanguage=Rust, GLSL
  |github=YaLTeR/niri
  |documentation=[https://github.com/YaLTeR/niri/wiki Official wiki], [https://github.com/sodiboo/niri-flake/blob/main/docs.md niri-flake]
}}
 
[https://github.com/YaLTeR/niri Niri] is a scrollable-tiling [[Wayland]] compositor.


== Installation ==
== Installation ==
Line 9: Line 21:
}}
}}


{{Note|Niri can be enabled without installing custom flake such as [https://github.com/sodiboo/niri-flake niri-flake]. It 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|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.}}
 
{{Warning|Without [[#Configuration]] or [[#Additional Setup]], or in other words after fresh installation, you may 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 ==
== Configuration ==
Line 25: Line 39:
== Additional Setup ==
== Additional Setup ==


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 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].
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].


{{file|~/.config/home-manager/home.nix|nix|3=
{{file|3=
programs.alacritty.enable = true; # Super+T in the default setting
security.polkit.enable = true; # polkit
programs.fuzzel.enable = true; # Super+D in the default setting
services.gnome.gnome-keyring.enable = true; # secret service
programs.swaylock.enable = true; # Super+Alt+L in the default setting
security.pam.services.swaylock = {};
programs.mako.enable = true;
 
programs.waybar.enable = true;
programs.waybar.enable = true; # top bar
services.swayidle.enable = true;
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=
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; [
home.packages = with pkgs; [
    swaybg
  swaybg # wallpaper
];
];
}}
|name=~/.config/home-manager/home.nix|lang=nix}}
 
== Troubleshooting ==
 
=== IME not working on Electron apps ===
 
There is a general workaround to set {{ic|NIXOS_OZONE_WL}} as described in [[Wayland#Electron_and_Chromium]]:


{{file|/etc/nixos/configuration.nix|nix|3=
{{file|/etc/nixos/configuration.nix|nix|3=
security.pam.services.swaylock = {};
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}}
}}
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:
{{code|<nowiki>slack --wayland-text-input-version=3</nowiki>}}
Alternatively, if the package supports {{ic|commandLineArgs}}, the following may be used instead:
{{code|<nowiki>(pkgs.vscode.override {
  commandLineArgs = [
    "--wayland-text-input-version=3"
  ];
});</nowiki>}}
== See Also ==
* [[Wayland]]
* [[Sway]]
* [[Wallpapers for Wayland]]
* [https://github.com/sodiboo/niri-flake/ niri-flake]


[[Category:Window managers]]
[[Category:Window managers]]
[[Category:Applications]]
[[Category:Applications]]

Latest revision as of 15:45, 5 September 2025

Niri

Wayland compositor Application

Initial release2023-11-26
StatusActive
Operating SystemLinux, FreeBSD
Language(s)Rust, GLSL
LicenseGNU General Public License v3.0 only
External links
GitHubYaLTeR/niri
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 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.
⚠︎
Warning: Without #Configuration or #Additional Setup, or in other words after fresh installation, you may unable to launch apps because of missing 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 [1].

See the wiki for configuration options for Niri.

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

Alternatively, if the package supports commandLineArgs, the following may be used instead:

(pkgs.vscode.override {
  commandLineArgs = [
    "--wayland-text-input-version=3"
  ];
});

See Also