Niri: Difference between revisions

34j (talk | contribs)
Troubleshooting: Use wrapProgram instead of commandLineArgs for build performance
Ardenet (talk | contribs)
m Adjust the position of translation tags
Line 20: Line 20:


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 25: Line 26:
}}
}}


{{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 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.}}
{{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 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.}}
{{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 37: Line 40:
}}
}}


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


Line 44: Line 48:


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


<translate>
== Troubleshooting ==
== Troubleshooting ==


Line 70: Line 76:


There is a general workaround to set {{ic|NIXOS_OZONE_WL}} as described in [[Wayland#Electron_and_Chromium]]:
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=
Line 75: Line 82:
}}
}}


<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:
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>}}
{{code|<nowiki>slack --wayland-text-input-version=3</nowiki>}}


<translate>
<code>wrapProgram</code> may be used to add the flag automatically:
<code>wrapProgram</code> may be used to add the flag automatically:
</translate>


{{file|/etc/nixos/configuration.nix|nix|3=
{{file|/etc/nixos/configuration.nix|nix|3=
Line 91: Line 102:
];}}
];}}


<translate>
=== 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/YaLTeR/niri/wiki/Xwayland this] article to learn more about this)
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; [  
{{File|3=environment.systemPackages = with pkgs; [  
Line 98: Line 111:
];|name=/etc/nixos/configuration.nix|lang=nix}}
];|name=/etc/nixos/configuration.nix|lang=nix}}


<translate>
Or using [[Home Manager]]
Or using [[Home Manager]]
</translate>


{{File|3=home.packages = with pkgs; [
{{File|3=home.packages = with pkgs; [
Line 104: Line 119:
];|name=~/.config/home-manager/home.nix|lang=nix}}
];|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.
After you installed {{ic|xwayland-satellite}} Niri will integrate it out of the box and all of your XWayland apps will function properly.


Line 110: Line 126:


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>
{{File|3=xdg.portal.config.niri = {
{{File|3=xdg.portal.config.niri = {
   "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; # or "kde"
   "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; # or "kde"
};|name=/etc/nixos/configuration.nix|lang=nix}}
};|name=/etc/nixos/configuration.nix|lang=nix}}


<translate>
== See Also ==
== See Also ==