Hyprland: Difference between revisions

From NixOS Wiki
imported>Niahex
Created page with "{{Expansion|Incomplete (reason: (Adding incrementally through testing and verification.))}} [https://hyprland.org/ Hyprland] is a wlroots-based tiling Wayland compositor..."
 
Unabomberlive (talk | contribs)
m Proper way to write in XDG config directory
 
(17 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Expansion|Incomplete (reason: (Adding incrementally through testing and verification.))}}
{{Expansion|Incomplete (reason: (Adding incrementally through testing and verification.))}}
{{Warning|At the moment, [https://wiki.hyprland.org/Nix/ upstream] provides a better documentation regarding installation and configuration. Please refer to it instead.}}


[https://hyprland.org/ Hyprland] is a wlroots-based tiling [[Wayland]] compositor written in C++. Noteworthy features of Hyprland include dynamic tiling, tabbed windows, a clean and readable C++ code-base, and a custom renderer that provides window animations, rounded corners, and Dual-Kawase Blur on transparent windows. General usage and configuration is thoroughly documented at [https://wiki.hyprland.org/ Hyprland wiki].  
[https://hyprland.org/ Hyprland] is a wlroots-based tiling [[Wayland]] compositor written in C++. Noteworthy features of Hyprland include dynamic tiling, tabbed windows, a clean and readable C++ code-base, and a custom renderer that provides window animations, rounded corners, and Dual-Kawase Blur on transparent windows. General usage and configuration is thoroughly documented at [https://wiki.hyprland.org/ Hyprland wiki].  


== Installation ==
== Installation ==
The NixOS module enables critical components needed to run Hyprland properly, such as:
{{Note|The respective modules should already take care of the majority of mentioned items in this list. }}
To run Hyprland properly you need to enables critical components, such as:
* [[polkit]]
* [[polkit]]
* [[xdg-desktop-portal-hyprland]]
* xdg-desktop-portal-hyprland  
* graphics drivers : [[Nvidia]], [[Amd]]
* graphics drivers : [[Nvidia]], [[AMD_GPU|AMD]]
* [[fonts]]
* [[fonts]]
* [[dconf]]
* [[dconf]]
* [[xwayland]]
* [[xwayland]]
* (Optional) add a proper [[Desktop Entry]] to your [[Display Manager]].
* [[display manager]]
If you use [[gdm]] or [[ldm]]: add a proper [[Desktop Entry]] to your [[display manager]].


Make sure to check out the options of the [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland NixOS module].
=== Using [[NixOS]] ===
=== Using [[NixOS]] ===


{{file|/etc/nixos/home.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{pkgs, ...}:  
{pkgs, ...}:  
{
{
Line 23: Line 25:
     enable = true;
     enable = true;
     # Whether to enable XWayland
     # Whether to enable XWayland
     xwayland = true;
     xwayland.enable = true;
 
    # Optional
    # Whether to enable patching wlroots for better Nvidia support
    enableNvidiaPatches = true;
   };
   };
  # ...
}
}
</nowiki>}}
</nowiki>}}
[https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=hyprland See all modules for NixOS]


=== Using [[Home Manager]] ===
=== Using [[Home Manager]] ===


{{file|/etc/nixos/configuration.nix or ~/.config/home-manager/home.nix|nix|<nowiki>
{{file|/etc/nixos/home.nix or ~/.config/home-manager/home.nix|nix|<nowiki>
{config, pkgs, ... }:  
{config, pkgs, ... }:  
{
{
Line 48: Line 48:
     # Whether to enable hyprland-session.target on hyprland startup
     # Whether to enable hyprland-session.target on hyprland startup
     systemd.enable = true;
     systemd.enable = true;
    # Whether to enable patching wlroots for better Nvidia support
  };
     enableNvidiaPatches = true;
  # ...
}
</nowiki>}}
[https://mipmip.github.io/home-manager-option-search/?query=hyprland See all modules for Home Manager]
 
=== Using [[Flake]] ===
 
== Configuration ==
 
=== Using [[Home Manager]] ===
 
You have two options for configuring the settings:
 
1. Compose the configuration using Nix syntax:
{{file|/etc/nixos/home.nix or ~/.config/home-manager/home.nix|nix|<nowiki>
{config, pkgs, ... }:
{
  wayland.windowManager.hyprland.settings = {
    decoration = {
      shadow_offset = "0 5";
      "col.shadow" = "rgba(00000099)";
    };
 
     "$mod" = "SUPER";


     # List of Hyprland plugins to use
     bindm = [
    plugins = [
      # mouse movements
       split-monitor-workspaces
      "$mod, mouse:272, movewindow"
      "$mod, mouse:273, resizewindow"
       "$mod ALT, mouse:272, resizewindow"
     ];
     ];
  };
  # ...
}
</nowiki>}}


    # Hyprland configuration written in Nix
2. You can also use Hyprland's syntax to write the file like this: :
    settings = {
{{file|/etc/nixos/home.nix or ~/.config/home-manager/home.nix|nix|<nowiki>
      decoration = {
{config, pkgs, ... }:
        shadow_offset = "0 5";
{
        "col.shadow" = "rgba(00000099)";
  xdg.configFile."hypr/hyprland.conf".text = ''
      };
    decoration {
      shadow_offset = 0 5
      col.shadow = rgba(00000099)
    }
 
    $mod = SUPER
 
    bindm = $mod, mouse:272, movewindow
    bindm = $mod, mouse:273, resizewindow
    bindm = $mod ALT, mouse:272, resizewindow
  '';
  # ...
}
</nowiki>}}


      "$mod" = "SUPER";
== Plugin ==
You need use flake for her, example:


      bindm = [
put this in your flake.nix
        # mouse movements
{{file|/etc/nixos/flake.nix or ~/.config/home-manager/flake.nix|nix|<nowiki>
        "$mod, mouse:272, movewindow"
{
         "$mod, mouse:273, resizewindow"
  inputs = {
         "$mod ALT, mouse:272, resizewindow"
    # ...
      ];
    hyprland.url = "github:hyprwm/Hyprland";
    plugin_name = {
         url = "github:maintener/plugin_name";
         inputs.hyprland.follows = "hyprland"; # IMPORTANT
     };
     };
   };
   };
}
}
</nowiki>}}


then, inside your home-manager module:
{{file|/etc/nixos/flake.nix or ~/.config/home-manager/flake.nix|nix|<nowiki>
{
  wayland.windowManager.hyprland = {
    plugins = [
        inputs.plugin_name.packages.${pkgs.system}.default
    ];
  };
}
</nowiki>}}
</nowiki>}}
[https://github.com/hyprland-community/awesome-hyprland#plugins List of plugins]
== Usage ==
== Troubleshooting ==
=== Swaylock ===
If swaylock cannot be unlocked with the correct password:
<code>
security.pam.services.swaylock = {};
</code>
== See also ==
* [https://hyprland.org/ Hyprland Website]
* [https://wiki.hyprland.org/ The official documentation]
* [https://github.com/hyprwm/Hyprland/ Hyprland Github Page]
* [https://github.com/hyprland-community/awesome-hyprland Community-maintained list of tools, plugins and extensions]
[[Category:Window managers]]
[[Category:Applications]]

Latest revision as of 08:45, 30 August 2024

Warning: At the moment, upstream provides a better documentation regarding installation and configuration. Please refer to it instead.

Hyprland is a wlroots-based tiling Wayland compositor written in C++. Noteworthy features of Hyprland include dynamic tiling, tabbed windows, a clean and readable C++ code-base, and a custom renderer that provides window animations, rounded corners, and Dual-Kawase Blur on transparent windows. General usage and configuration is thoroughly documented at Hyprland wiki.

Installation

Note: The respective modules should already take care of the majority of mentioned items in this list.

To run Hyprland properly you need to enables critical components, such as:

If you use gdm or ldm: add a proper Desktop Entry to your display manager.

Using NixOS

/etc/nixos/configuration.nix
{pkgs, ...}: 
{
  programs.hyprland = {
    # Install the packages from nixpkgs
    enable = true;
    # Whether to enable XWayland
    xwayland.enable = true;
  };
  # ...
}

See all modules for NixOS

Using Home Manager

/etc/nixos/home.nix or ~/.config/home-manager/home.nix
{config, pkgs, ... }: 
{
  wayland.windowManager.hyprland = {
    # Whether to enable Hyprland wayland compositor
    enable = true;
    # The hyprland package to use
    package = pkgs.hyprland;
    # Whether to enable XWayland
    xwayland.enable = true;

    # Optional
    # Whether to enable hyprland-session.target on hyprland startup
    systemd.enable = true;
  };
  # ...
}

See all modules for Home Manager

Using Flake

Configuration

Using Home Manager

You have two options for configuring the settings:

1. Compose the configuration using Nix syntax:

/etc/nixos/home.nix or ~/.config/home-manager/home.nix
{config, pkgs, ... }: 
{
  wayland.windowManager.hyprland.settings = {
    decoration = {
      shadow_offset = "0 5";
      "col.shadow" = "rgba(00000099)";
    };

    "$mod" = "SUPER";

    bindm = [
      # mouse movements
      "$mod, mouse:272, movewindow"
      "$mod, mouse:273, resizewindow"
      "$mod ALT, mouse:272, resizewindow"
    ];
  };
  # ...
}

2. You can also use Hyprland's syntax to write the file like this: :

/etc/nixos/home.nix or ~/.config/home-manager/home.nix
{config, pkgs, ... }: 
{
  xdg.configFile."hypr/hyprland.conf".text = ''
    decoration {
      shadow_offset = 0 5
      col.shadow = rgba(00000099)
    }

    $mod = SUPER

    bindm = $mod, mouse:272, movewindow
    bindm = $mod, mouse:273, resizewindow
    bindm = $mod ALT, mouse:272, resizewindow
  '';
  # ...
}

Plugin

You need use flake for her, example:

put this in your flake.nix

/etc/nixos/flake.nix or ~/.config/home-manager/flake.nix
{
  inputs = {
    # ...
    hyprland.url = "github:hyprwm/Hyprland";
    plugin_name = {
        url = "github:maintener/plugin_name";
        inputs.hyprland.follows = "hyprland"; # IMPORTANT
    };
  };
}

then, inside your home-manager module:

/etc/nixos/flake.nix or ~/.config/home-manager/flake.nix
{
  wayland.windowManager.hyprland = {
    plugins = [
        inputs.plugin_name.packages.${pkgs.system}.default
    ];
  };
}

List of plugins


Usage

Troubleshooting

Swaylock

If swaylock cannot be unlocked with the correct password: security.pam.services.swaylock = {};

See also