about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2024-04-27 08:36:44 +0200
committerGitHub <noreply@github.com>2024-04-27 08:36:44 +0200
commit121513ad016cb63f07fad78cf20ba234a0deb0eb (patch)
treecfe8f7708b71ffb4f2a0e359e4905c13f3246ab8 /nixos/modules
parent9acae24f938461ced352275a7bf4e48588b4c744 (diff)
parentd18a587b780447056ce9d316d68f5d418582dab3 (diff)
Merge pull request #307155 from JohnRTitor/hyprland-module
nixos/hyprland: Set environment variables for Hyprland to work better
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/programs/wayland/hyprland.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix
index 5891ff25e4375..e648eaa1b68e4 100644
--- a/nixos/modules/programs/wayland/hyprland.nix
+++ b/nixos/modules/programs/wayland/hyprland.nix
@@ -42,6 +42,15 @@ in
 
     xwayland.enable = mkEnableOption ("XWayland") // { default = true; };
 
+    envVars.enable = mkEnableOption null // {
+      default = true;
+      example = false;
+      description = ''
+        Set environment variables for Hyprland to work properly.
+        Enabled by default.
+      '';
+    };
+
     systemd.setPath.enable = mkEnableOption null // {
       default = true;
       example = false;
@@ -74,6 +83,15 @@ in
       configPackages = mkDefault [ cfg.finalPackage ];
     };
 
+    environment.sessionVariables = mkIf cfg.envVars.enable {
+      XDG_CURRENT_DESKTOP = "Hyprland";
+      XDG_SESSION_DESKTOP = "Hyprland";
+      XDG_SESSION_TYPE = "wayland";
+      GDK_BACKEND = "wayland,x11";
+      QT_QPA_PLATFORM = "wayland;xcb";
+      _JAVA_AWT_WM_NONREPARENTING = "1"; # Fix for Java applications on tiling window managers
+    };
+
     systemd = mkIf cfg.systemd.setPath.enable {
       user.extraConfig = ''
         DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin:/etc/profiles/per-user/%u/bin:/run/wrappers/bin"