From b84982fde7e70ed697f12edd89fc150aa8b42f6b Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Fri, 25 Apr 2025 22:55:08 +0100 Subject: [PATCH] hyprland: move env vars to uwsm --- users/jordan/graphical/hyprland/default.nix | 56 ++++++++++++++------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/users/jordan/graphical/hyprland/default.nix b/users/jordan/graphical/hyprland/default.nix index fda18e1..3245d8d 100644 --- a/users/jordan/graphical/hyprland/default.nix +++ b/users/jordan/graphical/hyprland/default.nix @@ -6,9 +6,38 @@ }: let inherit (lib) + attrValues + concatStringsSep elem - optionals + mapAttrs + mkIf ; + concatMapAttrsStringSep = + sep: f: attrs: + concatStringsSep sep (attrValues (mapAttrs f attrs)); + globalVariables = + { + _JAVA_AWT_WM_NONREPARENTING = "1"; + GDK_BACKEND = "wayland"; + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVE = "wayland"; + XDG_SESSION_TYPE = "wayland"; + } + // ( + if elem "nvidia" osConfig.services.xserver.videoDrivers then + { + GBM_BACKEND = "nvidia-drm"; + LIBVA_DRIVER_NAME = "nvidia"; + } + else + { } + ); + hyprVariables = { + AQ_DRM_DEVICES = "/dev/dri/card0:/dev/dri/card1"; + }; in { imports = [ @@ -22,26 +51,19 @@ in "SF Pro Text" ]; + xdg.configFile = mkIf osConfig.programs.hyprland.withUWSM { + "uwsm/env".text = concatMapAttrsStringSep "\n" ( + name: value: "export ${name}=${value}" + ) globalVariables; + "uwsm/env-hyprland".text = concatMapAttrsStringSep "\n" ( + name: value: "export ${name}=${value}" + ) hyprVariables; + }; + wayland.windowManager.hyprland = { enable = true; # plugins = [ hypr-dynamic-cursors ]; # https://github.com/VirtCode/hypr-dynamic-cursors settings = { - env = - optionals (elem "nvidia" osConfig.services.xserver.videoDrivers) [ - "GBM_BACKEND,nvidia-drm" - "LIBVA_DRIVER_NAME,nvidia" - ] - ++ [ - "_JAVA_AWT_WM_NONREPARENTING,1" - "GDK_BACKEND,wayland" - "MOZ_ENABLE_WAYLAND,1" - "NIXOS_OZONE_WL,1" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "QT_QPA_PLATFORM,wayland" - "SDL_VIDEODRIVER,wayland" - "XDG_SESSION_TYPE,wayland" - ]; - general = { gaps_in = 5; gaps_out = 20;