modules/wayland: fix xdg portals

This commit is contained in:
Bloxx12 2025-07-08 16:19:56 +02:00
commit a337eabba2
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
2 changed files with 38 additions and 17 deletions

View file

@ -1,5 +1,42 @@
_: {
{
config,
lib,
pkgs,
...
}: let
inherit (lib.modules) mkForce mkIf;
inherit (lib.options) mkEnableOption;
inherit (lib.lists) optional;
in {
imports = [
./variables.nix
];
xdg.portal = {
enable = true;
# Sets environment variable NIXOS_XDG_OPEN_USE_PORTAL to 1.
# This will make xdg-open use the portal to open programs,
# which resolves bugs involving programs opening inside FHS envs
# or with unexpected env vars set from wrappers.
# See #160923 for more info.
xdgOpenUsePortal = true;
extraPortals =
[
pkgs.xdg-desktop-portal-gtk
]
++ (
optional config.programs.niri.enable
pkgs.xdg-desktop-portal-gnome
)
++ (
optional config.programs.hyprland.enable
pkgs.xdg-desktop-portal-hyprland
);
config = {
common.default = mkIf config.programs.hyprland.enable ["*"];
};
configPackages = [
pkgs.niri
];
};
}

View file

@ -52,21 +52,5 @@ in {
inherit (pkgs) xwayland-satellite avizo;
inherit new-swww;
};
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-gnome
];
config = {
common.default = ["*"];
hyprland.default = ["gtk"];
};
configPackages = [
pkgs.niri
];
};
};
}