Hyprland: Difference between revisions
imported>Haemeah m fix broken link from October 13, 10:00 revision |
m Updates |
||
| (24 intermediate revisions by 11 users not shown) | |||
| Line 1: | Line 1: | ||
[https://hyprland.org/ Hyprland] is an independent, extensible, bleeding-edge [[Wayland]] compositor written in modern C++ with an emphasis on looks. In addition, Hyprland also offers a number of first-party tools as well as a custom plugin system. The most up-to-date and complete documentation may be found on the project's own [https://wiki.hyprland.org/ wiki]. | |||
Some of the most notable features of Hyprland are: | |||
* '''Independent Wayland implementation''': Does not rely on wlroots or other external libraries, and provides an in-house alternatives to common components (screen locking, idle daemon, etc). | |||
* '''Easy to configure''': Uses a live reloading config file in plain-text with useful defaults. | |||
* '''Dynamic tiling support''': Supports both automatic tiling and floating mode with multiple layouts. | |||
* '''Socket-based IPC''': Allows controlling the compositor at runtime via UNIX socket. | |||
* '''Global shortcuts''': Permits setting global keybinds for any application (for apps such as [[OBS Studio]]). | |||
* '''Window/Workspace Rules''': Set special behaviors for certain windows and workspaces. | |||
== Installation == | == Installation == | ||
NixOS 24.11 added support for launching Hyprland with [https://github.com/Vladimir-csp/uwsm Universal Wayland Session Manager] (UWSM) and is the recommended way to launch Hyprland as it neatly integrates with [[Systemd]]. [[UWSM|Options for configuring UWSM may be found here]]. Also see the Hyprland wiki [https://wiki.hypr.land/Useful-Utilities/Systemd-start/#uwsm page for UWSM here]. | |||
=== | {{file|||<nowiki> | ||
{ | |||
programs.hyprland = { | |||
enable = true; | |||
withUWSM = true; # recommended for most users | |||
xwayland.enable = true; # Xwayland can be disabled. | |||
}; | |||
} | |||
</nowiki>|name=/etc/nixos/configuration.nix|lang=nix}}{{Warning|If you use the Home Manager module, make sure to disable systemd integration, as it conflicts with UWSM. | |||
</br> | |||
{{File|3=wayland.windowManager.hyprland.systemd.enable = false; | |||
|name=/etc/nixos/home.nix|lang=nix}}}} | |||
=== Nix on Non-NixOS Systems === | |||
If you use the Nix package manager on-top of a non-NixOS distribution then Hyprland can still be installed (albeit with less support than the NixOS module). | |||
Firstly, enable [https://wiki.nixos.org/wiki/Flakes#Other_Distros,_without_Home-Manager flakes] in your Nix installation. Then install Hyprland through <code>nix profile</code>: | |||
<syntaxHighlight lang=text> | |||
nix profile install nixpkgs#hyprland | |||
</syntaxHighlight> | |||
In order for Hyprland to find graphics drivers on a non-NixOS system, you will need to install [[nixGL]]: | |||
<syntaxHighlight lang=text> | |||
nix profile install github:guibou/nixGL --impure | |||
</syntaxHighlight> | |||
{{file| | Now you can run Hyprland by invoking it with NixGL: | ||
<syntaxHighlight lang=text> | |||
nixGL Hyprland | |||
</syntaxHighlight> | |||
==== Hypr Ecosystem ==== | |||
You may also be interested in the Hypr project's collection of tools: | |||
* '''hyprlock''': Hyprland's GPU-accelerated screen locking utility. | |||
* '''hypridle''': Hyprland's idle daemon. | |||
* [[hyprpaper]]: Hyprland's wallpaper utility. | |||
* '''hyprsunset''': Application to enable a blue-light filter on Hyprland. | |||
* '''hyprpicker''': Wayland color picker that does not suck. | |||
* '''hyprpolkitagent''': Polkit authentication agent written in QT/QML. | |||
All official Hypr* programs are listed in the project's [https://wiki.hyprland.org/Hypr-Ecosystem/ wiki page] along with documentation. | |||
=== Hyprland Flake === | |||
{{Warning|Installing Hyprland through a Nix flake will require the system to recompile Hyprland and all of its dependencies each time it updates. To avoid this, setup [[Hyprland#Cachix|Hyprland's Cachix settings]] before adding Hyprland as a flake input.}} | |||
If you wish to run a development version of Hyprland, you can easily do so by adding its flake to your flake inputs as demonstrated below: | |||
{{file|flake.nix|nix|<nowiki> | |||
{ | { | ||
inputs.hyprland.url = "github:hyprwm/Hyprland"; | |||
# ... | |||
outputs = {nixpkgs, ...} @ inputs: { | |||
nixosConfigurations.YOUR_HOSTNAME = nixpkgs.lib.nixosSystem { | |||
specialArgs = { inherit inputs; }; # this is the important part | |||
modules = [ | |||
./configuration.nix | |||
# ... | |||
]; | |||
}; | |||
}; | |||
} | |||
</nowiki>}} | |||
{{file|configuration.nix|nix|<nowiki> | |||
{inputs, pkgs, ...}: { | |||
programs.hyprland = { | programs.hyprland = { | ||
enable = true; | enable = true; | ||
# | # set the flake package | ||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; | |||
# make sure to also set the portal package, so that they are in sync | |||
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; | |||
}; | }; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
=== | If you experience performance drops in video games or graphics tools like Blender on stable NixOS, then it's likely a [[Mesa]] version mismatch with Hyprland and the rest of your system. This can be fixed by substituting the system's mesa package with Hyprland's own. | ||
{{file|3=<nowiki> | |||
{pkgs, inputs, ...}: let | |||
pkgs-unstable = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}; | |||
in { | |||
hardware.graphics = { | |||
package = pkgs-unstable.mesa; | |||
# if you also want 32-bit support (e.g for Steam) | |||
enable32Bit = true; | |||
package32 = pkgs-unstable.pkgsi686Linux.mesa; | |||
}; | |||
} | |||
</nowiki>|name=configuration.nix|lang=nix}} | |||
==== Cachix ==== | |||
If you use the Hyprland flake, you'll have to rebuild Hyprland as well as any of its dependencies (mesa, ffmpeg, etc). To avoid this, use the [https://app.cachix.org/cache/hyprland Cachix cache] provided by Hyprland to supplement any dependency not supplied by Hydra. Note that the setting has to be enabled '''before''' using the Hyprland flake package (meaning you should rebuild at least once before adding the flake input). | |||
{{file|configuration.nix|nix|<nowiki> | |||
{ | |||
nix.settings = { | |||
substituters = ["https://hyprland.cachix.org"]; | |||
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; | |||
}; | |||
} | |||
</nowiki>}} | |||
{{file| | === Screensharing === | ||
{{file|configuration.nix|nix|<nowiki> | |||
{ | { | ||
xdg.portal = { | |||
enable = true; | enable = true; | ||
extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ]; | |||
}; | }; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
=== | |||
=== Display Manager Support === | |||
By default, Hyprland does not come with a [https://wiki.nixos.org/wiki/Wayland#Display_Managers display manager] and does not advertise support for one. Though one can start hyprland directly from tty with <code>Hyprland</code> or with <code>uwsm start select</code>, some display managers packaged in NixOS are compatible including but may not be limited to: | |||
* [[SDDM]] | |||
* [[GDM]] (works but crashes Hyprland on first launch) | |||
* [[Greetd]] (especially with ReGreet) | |||
* [[Ly]] (not recommended but works) | |||
== Configuration == | == Configuration == | ||
On first run, Hyprland will create a configuration file with autogenerated defauts in <code>$XDG_CONFIG_HOME/hypr/hyprland.conf</code> if it does not exist. An example configuration can be found in the [https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.conf project's git repository]. | |||
=== Using [[Home Manager]] === | === Using [[Home Manager]] === | ||
Home Manager allows for declarative configuration of Hyprland using Nix syntax. Entries with the same key should be written as lists. Variables’ and colors’ names should be quoted. | |||
Find additional options under [https://home-manager.dev/manual/23.11/options.xhtml#opt-wayland.windowManager.hyprland.enable Home Manager - wayland.windowManager.hyprland]. Also, see the [https://wiki.hypr.land/Nix/Hyprland-on-Home-Manager/ Hyprland Page for Home Manager] for more examples. | |||
{{File|3=wayland.windowManager.hyprland = { | |||
{{ | systemd.enable = false; | ||
settings = { | |||
decoration = { | decoration = { | ||
shadow_offset = "0 5"; | shadow_offset = "0 5"; | ||
| Line 73: | Line 154: | ||
"$mod" = "SUPER"; | "$mod" = "SUPER"; | ||
bind = [ | |||
# Execute Rofi with only the SUPER key | |||
"$mod, Super_L, exec, pkill rofi {{!}}{{!}} rofi -show drun" | |||
"$mod, F, exec, librewolf" | |||
"CONTROL ALT, T, exec, wezterm" | |||
]; | |||
# Startup Apps | |||
exec-once = [ | |||
"hyprpanel" | |||
]; | |||
bindm = [ | bindm = [ | ||
| Line 81: | Line 176: | ||
]; | ]; | ||
}; | }; | ||
};|name=/etc/nixos/home.nix|lang=nix}} | |||
} | |||
== Plugin Support == | |||
Hyprland boasts a growing plugin ecosystem that extends the functionality of the compositor such as adding support for window decorations or a GNOME-like workspaces design. However, hyprpm is unsupported on NixOS due to the way Hyprland is built. | |||
The [[Home Manager]] module for Hyprland should be used instead: | |||
{{File|3={ | |||
wayland.windowManager.hyprland.plugins = [ | |||
pkgs.hyprlandPlugins.PLUGIN_NAME | |||
]; | |||
}|name=/etc/nixos/home.nix|lang=nix}} | |||
} | |||
[https://github.com/hyprwm/hyprland-plugins hyprland-plugins] is a repository of first-party plugins. If you wish to use these plugins it is recommended to use the Hyprland flake instead of the Nixpkgs version, and to use the [[Home Manager]] module for configuration. | |||
Add the flake into your flake inputs: | |||
{{file| | {{file|flake.nix|nix|<nowiki> | ||
{ | { | ||
inputs = { | inputs = { | ||
hyprland.url = "github:hyprwm/Hyprland"; | hyprland.url = "github:hyprwm/Hyprland"; | ||
hyprland-plugins = { | |||
url = "github:hyprwm/hyprland-plugins"; | |||
inputs.hyprland.follows = "hyprland"; # Prevents version mismatch. | |||
}; | }; | ||
} | |||
# ... | |||
} | |||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
Then, add the plugin using the hyprland-plugins input: | |||
{{file|/etc/nixos/ | |||
{ | {{file|/etc/nixos/home.nix or ~/.config/home-manager/home.nix|nix|<nowiki> | ||
{inputs, pkgs, ...}: { | |||
wayland.windowManager.hyprland = { | wayland.windowManager.hyprland = { | ||
enable = true; | |||
plugins = [ | plugins = [ | ||
inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.PLUGIN_NAME | |||
]; | ]; | ||
}; | }; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
[https://github.com/hyprland-community/awesome-hyprland#plugins List of plugins] | [https://github.com/hyprland-community/awesome-hyprland#plugins List of plugins] | ||
== Troubleshooting == | == Troubleshooting == | ||
=== Swaylock === | === Swaylock === | ||
If swaylock cannot be unlocked with the correct password: | If swaylock cannot be unlocked with the correct password: | ||
<code> | <code> | ||
security.pam.services.swaylock = {}; | security.pam.services.swaylock = {}; | ||
</code> | </code> | ||
=== Electron applications defaulting to X11 rather than Wayland === | |||
Set the environment variable <code>NIXOS_OZONE_WL</code> to "1" in your NixOS configuration: | |||
{{file|configuration.nix|nix|<nowiki> | |||
{ | |||
environment.sessionVariables.NIXOS_OZONE_WL = "1"; | |||
} | |||
</nowiki>}} | |||
=== Theme Support === | |||
To make themes consistent in Hyprland, you can either use Home Manager like this: | |||
{{file|/etc/nixos/home.nix or ~/.config/home-manager/home.nix|nix|<nowiki> | |||
{ | |||
home.pointerCursor = { | |||
gtk.enable = true; | |||
# x11.enable = true; | |||
package = pkgs.bibata-cursors; | |||
name = "Bibata-Modern-Classic"; | |||
size = 16; | |||
}; | |||
gtk = { | |||
enable = true; | |||
theme = { | |||
package = pkgs.flat-remix-gtk; | |||
name = "Flat-Remix-GTK-Grey-Darkest"; | |||
}; | |||
iconTheme = { | |||
package = pkgs.adwaita-icon-theme; | |||
name = "Adwaita"; | |||
}; | |||
font = { | |||
name = "Sans"; | |||
size = 11; | |||
}; | |||
}; | |||
} | |||
</nowiki>}} | |||
or set themes using dconf in your Hyprland configuration file: | |||
{{file|hyprland.conf|conf|<nowiki> | |||
exec-once = dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita'" | |||
exec-once = dconf write /org/gnome/desktop/interface/icon-theme "'Flat-Remix-Red-Dark'" | |||
exec-once = dconf write /org/gnome/desktop/interface/document-font-name "'Noto Sans Medium 11'" | |||
exec-once = dconf write /org/gnome/desktop/interface/font-name "'Noto Sans Medium 11'" | |||
exec-once = dconf write /org/gnome/desktop/interface/monospace-font-name "'Noto Sans Mono Medium 11'" | |||
</nowiki>}}You may also install graphical tools such as gnome tweaks or nwg-look to set the themes manually. | |||
== See also == | == See also == | ||
Latest revision as of 04:23, 13 December 2025
Hyprland is an independent, extensible, bleeding-edge Wayland compositor written in modern C++ with an emphasis on looks. In addition, Hyprland also offers a number of first-party tools as well as a custom plugin system. The most up-to-date and complete documentation may be found on the project's own wiki.
Some of the most notable features of Hyprland are:
- Independent Wayland implementation: Does not rely on wlroots or other external libraries, and provides an in-house alternatives to common components (screen locking, idle daemon, etc).
- Easy to configure: Uses a live reloading config file in plain-text with useful defaults.
- Dynamic tiling support: Supports both automatic tiling and floating mode with multiple layouts.
- Socket-based IPC: Allows controlling the compositor at runtime via UNIX socket.
- Global shortcuts: Permits setting global keybinds for any application (for apps such as OBS Studio).
- Window/Workspace Rules: Set special behaviors for certain windows and workspaces.
Installation
NixOS 24.11 added support for launching Hyprland with Universal Wayland Session Manager (UWSM) and is the recommended way to launch Hyprland as it neatly integrates with Systemd. Options for configuring UWSM may be found here. Also see the Hyprland wiki page for UWSM here.
{
programs.hyprland = {
enable = true;
withUWSM = true; # recommended for most users
xwayland.enable = true; # Xwayland can be disabled.
};
}
wayland.windowManager.hyprland.systemd.enable = false;
Nix on Non-NixOS Systems
If you use the Nix package manager on-top of a non-NixOS distribution then Hyprland can still be installed (albeit with less support than the NixOS module).
Firstly, enable flakes in your Nix installation. Then install Hyprland through nix profile:
nix profile install nixpkgs#hyprland
In order for Hyprland to find graphics drivers on a non-NixOS system, you will need to install nixGL:
nix profile install github:guibou/nixGL --impure
Now you can run Hyprland by invoking it with NixGL:
nixGL Hyprland
Hypr Ecosystem
You may also be interested in the Hypr project's collection of tools:
- hyprlock: Hyprland's GPU-accelerated screen locking utility.
- hypridle: Hyprland's idle daemon.
- hyprpaper: Hyprland's wallpaper utility.
- hyprsunset: Application to enable a blue-light filter on Hyprland.
- hyprpicker: Wayland color picker that does not suck.
- hyprpolkitagent: Polkit authentication agent written in QT/QML.
All official Hypr* programs are listed in the project's wiki page along with documentation.
Hyprland Flake
If you wish to run a development version of Hyprland, you can easily do so by adding its flake to your flake inputs as demonstrated below:
{
inputs.hyprland.url = "github:hyprwm/Hyprland";
# ...
outputs = {nixpkgs, ...} @ inputs: {
nixosConfigurations.YOUR_HOSTNAME = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; }; # this is the important part
modules = [
./configuration.nix
# ...
];
};
};
}
{inputs, pkgs, ...}: {
programs.hyprland = {
enable = true;
# set the flake package
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# make sure to also set the portal package, so that they are in sync
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
};
}
If you experience performance drops in video games or graphics tools like Blender on stable NixOS, then it's likely a Mesa version mismatch with Hyprland and the rest of your system. This can be fixed by substituting the system's mesa package with Hyprland's own.
{pkgs, inputs, ...}: let
pkgs-unstable = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
hardware.graphics = {
package = pkgs-unstable.mesa;
# if you also want 32-bit support (e.g for Steam)
enable32Bit = true;
package32 = pkgs-unstable.pkgsi686Linux.mesa;
};
}
Cachix
If you use the Hyprland flake, you'll have to rebuild Hyprland as well as any of its dependencies (mesa, ffmpeg, etc). To avoid this, use the Cachix cache provided by Hyprland to supplement any dependency not supplied by Hydra. Note that the setting has to be enabled before using the Hyprland flake package (meaning you should rebuild at least once before adding the flake input).
{
nix.settings = {
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
}
Screensharing
{
xdg.portal = {
enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ];
};
}
Display Manager Support
By default, Hyprland does not come with a display manager and does not advertise support for one. Though one can start hyprland directly from tty with Hyprland or with uwsm start select, some display managers packaged in NixOS are compatible including but may not be limited to:
- SDDM
- GDM (works but crashes Hyprland on first launch)
- Greetd (especially with ReGreet)
- Ly (not recommended but works)
Configuration
On first run, Hyprland will create a configuration file with autogenerated defauts in $XDG_CONFIG_HOME/hypr/hyprland.conf if it does not exist. An example configuration can be found in the project's git repository.
Using Home Manager
Home Manager allows for declarative configuration of Hyprland using Nix syntax. Entries with the same key should be written as lists. Variables’ and colors’ names should be quoted.
Find additional options under Home Manager - wayland.windowManager.hyprland. Also, see the Hyprland Page for Home Manager for more examples.
wayland.windowManager.hyprland = {
systemd.enable = false;
settings = {
decoration = {
shadow_offset = "0 5";
"col.shadow" = "rgba(00000099)";
};
"$mod" = "SUPER";
bind = [
# Execute Rofi with only the SUPER key
"$mod, Super_L, exec, pkill rofi || rofi -show drun"
"$mod, F, exec, librewolf"
"CONTROL ALT, T, exec, wezterm"
];
# Startup Apps
exec-once = [
"hyprpanel"
];
bindm = [
# mouse movements
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];
};
};
Plugin Support
Hyprland boasts a growing plugin ecosystem that extends the functionality of the compositor such as adding support for window decorations or a GNOME-like workspaces design. However, hyprpm is unsupported on NixOS due to the way Hyprland is built.
The Home Manager module for Hyprland should be used instead:
{
wayland.windowManager.hyprland.plugins = [
pkgs.hyprlandPlugins.PLUGIN_NAME
];
}
hyprland-plugins is a repository of first-party plugins. If you wish to use these plugins it is recommended to use the Hyprland flake instead of the Nixpkgs version, and to use the Home Manager module for configuration.
Add the flake into your flake inputs:
{
inputs = {
hyprland.url = "github:hyprwm/Hyprland";
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland"; # Prevents version mismatch.
};
# ...
}
}
Then, add the plugin using the hyprland-plugins input:
{inputs, pkgs, ...}: {
wayland.windowManager.hyprland = {
enable = true;
plugins = [
inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.PLUGIN_NAME
];
};
}
Troubleshooting
Swaylock
If swaylock cannot be unlocked with the correct password:
security.pam.services.swaylock = {};
Electron applications defaulting to X11 rather than Wayland
Set the environment variable NIXOS_OZONE_WL to "1" in your NixOS configuration:
{
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}
Theme Support
To make themes consistent in Hyprland, you can either use Home Manager like this:
{
home.pointerCursor = {
gtk.enable = true;
# x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 16;
};
gtk = {
enable = true;
theme = {
package = pkgs.flat-remix-gtk;
name = "Flat-Remix-GTK-Grey-Darkest";
};
iconTheme = {
package = pkgs.adwaita-icon-theme;
name = "Adwaita";
};
font = {
name = "Sans";
size = 11;
};
};
}
or set themes using dconf in your Hyprland configuration file:
exec-once = dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita'"
exec-once = dconf write /org/gnome/desktop/interface/icon-theme "'Flat-Remix-Red-Dark'"
exec-once = dconf write /org/gnome/desktop/interface/document-font-name "'Noto Sans Medium 11'"
exec-once = dconf write /org/gnome/desktop/interface/font-name "'Noto Sans Medium 11'"
exec-once = dconf write /org/gnome/desktop/interface/monospace-font-name "'Noto Sans Mono Medium 11'"You may also install graphical tools such as gnome tweaks or nwg-look to set the themes manually.