From 300e25e6f1910af0c24e819ce07e4429e5f16a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Wed, 25 Jun 2025 18:00:33 -0600 Subject: [PATCH] feat: Configure XDG portal --- modules/home/users/crumb/niri.nix | 31 +++++++++++++++++++++++++++++++ modules/nixos/niri.nix | 18 ------------------ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/modules/home/users/crumb/niri.nix b/modules/home/users/crumb/niri.nix index 734d7a7..972042a 100644 --- a/modules/home/users/crumb/niri.nix +++ b/modules/home/users/crumb/niri.nix @@ -24,6 +24,37 @@ in { services.polkit-gnome.enable = true; + # File-picker. + home.packages = [ pkgs.nautilus ]; + + # Enable the XDG portal, an interface for programs to request + # permissions/resources. This is necessary to screen-cast on + # Wayland/Pipewire. + # + # See https://github.com/YaLTeR/niri/wiki/Important-Software#portals. + # Niri's NixOS module automatically brings in xdg-desktop-portal-gnome and + # gnome-keyring. + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-gnome + ]; + + # Use xdg-desktop-portal-gtk by default, but fallback to + # xdg-desktop-portal-gnome for screenshots and screen-casts, two important + # features unsupported by the GTK implementation. See implementations and + # their supported interfaces at + # https://wiki.archlinux.org/title/XDG_Desktop_Portal. + config.niri = { + default = [ "gtk" ]; + "org.freedesktop.impl.portal.Screenshot" = [ "gnome" ]; + "org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ]; + }; + }; + systemd.user.services.xwayland-satellite = lib.mkIf cfg.xwayland-satellite.enable { Service.ExecStart = diff --git a/modules/nixos/niri.nix b/modules/nixos/niri.nix index 5758a51..ce0e51e 100644 --- a/modules/nixos/niri.nix +++ b/modules/nixos/niri.nix @@ -15,24 +15,6 @@ in { }; security.pam.services.swaylock = {}; - - # Necessary for e.g. screensharing. - xdg.portal = { - enable = true; - # See https://github.com/YaLTeR/niri/wiki/Important-Software#portals. - # Niri's NixOS module appears to automatically bring in - # xdg-desktop-portal-gnome and gnome-keyring. - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - pkgs.xdg-desktop-portal-wlr - ]; - xdgOpenUsePortal = true; - config.preferred = { - default = [ "gtk" ]; - "org.freedesktop.impl.portal.Screenshot" = [ "wlr" ]; - "org.freedesktop.impl.portal.ScreenCast" = [ "wlr" ]; - }; - }; }; }