Niri: Difference between revisions

Zimward (talk | contribs)
The gnome desktop portal does get installed by the nixos module already. installing them into system/user path was never correct to begin with too.
m Update niri casing to lowercase "niri"
 
(25 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:niri}}
{{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 = niri-wm/niri
| documentation = [https://yalter.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 = 25.11; 29 Nov 2025
}}
<translate>
[https://github.com/YaLTeR/niri Niri] is a scrollable-tiling [[Wayland]] compositor.
[https://github.com/YaLTeR/niri Niri] is a scrollable-tiling [[Wayland]] compositor.


Line 4: Line 21:


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=
Line 9: Line 27:
}}
}}


{{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>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>}}


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


<translate>
== Configuration ==
== Configuration ==


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


{{file|~/.config/home-manager/home.nix|nix|3=
{{file|~/.config/home-manager/home.nix|nix|3=
Line 21: Line 41:
}}
}}


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


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


== 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 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].
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].
</translate>


{{file|~/.config/home-manager/home.nix|nix|3=
{{file|3=
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 ];
|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.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 41: Line 70:
];
];
|name=~/.config/home-manager/home.nix|lang=nix}}
|name=~/.config/home-manager/home.nix|lang=nix}}
<translate>
== 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]]:
</translate>


{{file|/etc/nixos/configuration.nix|nix|3=
{{file|/etc/nixos/configuration.nix|nix|3=
security.polkit.enable = true; # polkit
environment.sessionVariables.NIXOS_OZONE_WL = "1";
services.gnome.gnome-keyring.enable = true; # secret service
security.pam.services.swaylock = {};
}}
}}


<translate>
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>}}
<translate>
<code>wrapProgram</code> may be used to add the flag automatically:
</translate>
{{file|/etc/nixos/configuration.nix|nix|3=
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";
  };)
];}}
<translate>
=== XWayland apps not working ===
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)
</translate>
{{File|3=environment.systemPackages = with pkgs; [
    xwayland-satellite # xwayland support
];|name=/etc/nixos/configuration.nix|lang=nix}}
<translate>
Or using [[Home Manager]]
</translate>
{{File|3=home.packages = with pkgs; [
  xwayland-satellite # xwayland support
];|name=~/.config/home-manager/home.nix|lang=nix}}
<translate>
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 ===
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.
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>
== See Also ==
== See Also ==


* [[Wayland]]
* [[Sway]]
* [[Sway]]
* [[Wallpapers for Wayland]]
* [[Wallpapers for Wayland]]
* https://github.com/sodiboo/niri-flake/blob/main/flake.nix
* [https://github.com/sodiboo/niri-flake/ niri-flake]
* https://github.com/sodiboo/niri-flake#additional-notes
</translate>


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