Note
Everything written here is based on MY RESEARCH AND MY ASSUMPTIONS
Problem
The log output shows that xdg-desktop-portal assigns all interfaces to the GTK portal ("Choosing gtk.portal for…"), which means the system doesn't recognize a GNOME session. Without correct session detection, xdg-desktop-portal-gnome refuses to start because it requires an active graphical session.
Symptoms
busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.ScreenCast CreateSession a{sv} 0returns "No such interface"systemctl --user status xdg-desktop-portal-gnome.serviceshows "inactive (dead)"- Only GTK and WLR portals are running, but no GNOME portal
Solution
If you have any xdg portal configs in your home manager then remove it
Add the following snippet to your configuration.nix:
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-gnome
];
config = {
common = {
default = [ "gtk" ];
};
niri = {
default = [
"gtk"
"gnome"
];
"org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ];
"org.freedesktop.impl.portal.Screenshot" = [ "gnome" ];
};
};
};
Add session environment variables to help portal detection:
environment.sessionVariables = {
XDG_CURRENT_DESKTOP = "niri";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "niri";
};
Optionally add required GNOME packages:
environment.systemPackages = with pkgs; [
gnome-keyring
nautilus
];
Rebuild your system and restart your session:
sudo nixos-rebuild switch
Verification
After applying the fix, verify that screensharing works:
systemctl --user status xdg-desktop-portal-gnome.service
busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.ScreenCast CreateSession a{sv} 0
echo $XDG_CURRENT_DESKTOP
echo $XDG_SESSION_TYPE
Why this happens
- Niri requires xdg-desktop-portal-gnome specifically for screencasting functionality
- Without proper session environment variables, the GNOME portal won't start
- The system falls back to GTK portal which doesn't support ScreenCast interface
- This became more prominent after xdg-desktop-portal version 1.17 changed how portal implementations are loaded
Additional Notes
- Make sure to run Niri as a session (via niri-session or display manager), not in windowed mode
- PipeWire must be running and properly configured for screencasting to work
- The configuration creates explicit portal assignments for the Niri desktop environment