From 077f0cb14de8228b91a8a13b9a88d2b9314dec40 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 4 Aug 2024 15:51:55 +0300 Subject: [PATCH] hyprland: add xdg.portal configuration Add integration with `xdg.portal`, and the `portalPackage` option for `xdg-desktop-portal-hyprland`. --- modules/services/window-managers/hyprland.nix | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 73602ec61..8e81c11f7 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -58,6 +58,8 @@ in { package = lib.mkPackageOption pkgs "hyprland" { }; + portalPackage = lib.mkPackageOption pkgs "xdg-desktop-portal-hyprland" { }; + finalPackage = lib.mkOption { type = lib.types.package; readOnly = true; @@ -69,6 +71,18 @@ in { ''; }; + finalPortalPackage = lib.mkOption { + type = lib.types.package; + readOnly = true; + default = cfg.portalPackage.override { hyprland = cfg.finalPackage; }; + defaultText = lib.literalMD '' + `wayland.windowManager.hyprland.portalPackage` with + `wayland.windowManager.hyprland.finalPackage` override''; + description = '' + The xdg-desktop-portal-hyprland package after overriding its hyprland input. + ''; + }; + plugins = lib.mkOption { type = with lib.types; listOf (either package path); default = [ ]; @@ -264,6 +278,12 @@ in { ''; }; + xdg.portal = { + enable = true; + extraPortals = [ cfg.finalPortalPackage ]; + configPackages = lib.mkDefault [ cfg.finalPackage ]; + }; + systemd.user.targets.hyprland-session = lib.mkIf cfg.systemd.enable { Unit = { Description = "Hyprland compositor session";