feat: Configure XDG portal

This commit is contained in:
2025-06-25 18:00:33 -06:00
parent a364710a01
commit 300e25e6f1
2 changed files with 31 additions and 18 deletions

View File

@@ -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 =

View File

@@ -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" ];
};
};
};
}