XDG Portal Issues

I know this issue has been brought up time and time again, with many helpful threads already out there. However, I have not been able to find anything to fix my issue. Recently, I refactored my whole config, making it more modularized. In doing so, I somehow broken my portals module although I thought I had implemented correctly.

Using gh auth login gives me this error:


Press Enter to open https://github.com/login/device in your browser... 
Error: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.OpenURI” on object at path /org/freedesktop/portal/desktop
! Failed opening a web browser at https://github.com/login/device
  exit status 4
  Please try entering the URL in your browser manually

Links and such on other programs also do not open in the browser automatically when clicked. If anyone can help me figure out what it is I’m missing, I’ll be eternally grateful!

Link to my portals module

Check the portal services with systemctl --user status xdg-desktop-portal-<name>.service

doing systemctl --user status xdg-desktop-portal.service xdg-desktop-portal-gtk.service shows:

â—Ź xdg-desktop-portal.service - Portal service
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal.service; linked-runtime; preset: ignored)
     Active: active (running) since Sun 2025-10-05 16:19:01 EDT; 17min ago
 Invocation: 446f9b26975140b7840c049d2aa981ff
   Main PID: 2802 (.xdg-desktop-po)
      Tasks: 7 (limit: 76760)
     Memory: 6.8M (peak: 7.6M)
        CPU: 139ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─2802 /nix/store/fs7qnhj61x282g4hm6mlp7hk5rcl26ja-xdg-desktop-portal-1.20.3/libexec/xdg-desktop-port>

Oct 05 16:19:01 osaka systemd[2548]: Starting Portal service...
Oct 05 16:19:01 osaka systemd[2548]: Started Portal service.
Oct 05 16:19:01 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 2889: pidns required but >
Oct 05 16:19:01 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 2889: pidns required but >
Oct 05 16:19:01 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 2890: pidns required but >
Oct 05 16:19:01 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 2890: pidns required but >
Oct 05 16:19:10 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 3859: pidns required but >
Oct 05 16:19:10 osaka .xdg-desktop-po[2802]: Realtime error: Could not get pidns for pid 3859: pidns required but >

â—‹ xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-gtk.service; linked-runtime; preset: ignored)
     Active: inactive (dead)

I’m not sure how to get the gtk portal to start, I already have this in my hyprland config:

      exec-once = dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
      exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP

EDIT:
I was able to start it by adding systemctl --user start xdg-desktop-portal-gtk.service to my config

❯ systemctl --user status xdg-desktop-portal.service xdg-desktop-portal-gtk.service
â—Ź xdg-desktop-portal.service - Portal service
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal.service; linked-runtime; preset: ignored)
     Active: active (running) since Sun 2025-10-05 16:46:00 EDT; 32s ago
 Invocation: 2cc96ec5754b40acaa268d40f5a40f19
   Main PID: 2546 (.xdg-desktop-po)
      Tasks: 7 (limit: 76760)
     Memory: 6.8M (peak: 7.3M)
        CPU: 73ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─2546 /nix/store/fs7qnhj61x282g4hm6mlp7hk5rcl26ja-xdg-desktop-portal-1.20.3/libexec/xdg->

Oct 05 16:46:00 osaka systemd[2285]: Starting Portal service...
Oct 05 16:46:00 osaka systemd[2285]: Started Portal service.
Oct 05 16:46:01 osaka .xdg-desktop-po[2546]: Realtime error: Could not get pidns for pid 2631: pidns r>
Oct 05 16:46:01 osaka .xdg-desktop-po[2546]: Realtime error: Could not get pidns for pid 2631: pidns r>
Oct 05 16:46:11 osaka .xdg-desktop-po[2546]: Realtime error: Could not get pidns for pid 3759: pidns r>
Oct 05 16:46:11 osaka .xdg-desktop-po[2546]: Realtime error: Could not get pidns for pid 3759: pidns r>

â—Ź xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-gtk.service; linked-runtime; preset: ignored)
     Active: active (running) since Sun 2025-10-05 16:46:00 EDT; 33s ago
 Invocation: f50263a1d84e4a1780c5dd5b2d01c513
   Main PID: 2439 (.xdg-desktop-po)
      Tasks: 5 (limit: 76760)
     Memory: 13.3M (peak: 13.7M)
        CPU: 135ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gtk.service
             └─2439 /nix/store/6q57jwizy87i528lqcrkbx06mz12kbk4-xdg-desktop-portal-gtk-1.15.3/libexec/>

Oct 05 16:46:00 osaka systemd[2285]: Starting Portal service (GTK/GNOME implementation)...
Oct 05 16:46:00 osaka systemd[2285]: Started Portal service (GTK/GNOME implementation).

However, this does not fix the issue of the portals not opening links

umm… i dont have anything like that in my hyprland.conf? and the default config doesnt come with it? im not sure why would one need that on nixOS?

do you have…

xdg.portal.enable = true;

in your configuration.nix? it is false by default

you can then (maybe) use…

xdg.portal.xdgOpenUsePortal = true;

to bypass xdg-open, but it is rarely (?) used! it is also false by default

but in “extreme” cases, you can manually set which portal opens OpenURI:

xdg.portal.config.common."org.freedesktop.portal.OpenURI" = [ "*" "hyprland" ];

at least i think this is how it works… maybe "*;hyprland" is also valid :innocent:

also, instead of common (all environments) you can use hyprland to make it specific to that session

(actually idk if hyprland has this functionality, which is why xdg-desktop-portal-hyprland portal cant open links and is looking for xdg-desktop-portal)

again, any of this wont work without that xdg.portal.enable option!

I believe if you looked at my linked config, everything you suggested should already be set. I did try using xdg.portal.config.common."org.freedesktop.portal.OpenURI" = [ "*" "hyprland" ]; but to no avail x.x

As for the hyprland stuff, it seems that I have mistaken what the commands did, they are not related to the portals I don’t think (besides the one I added.)

ohh. i dont remember seeing this link tonight… my bad…

hmm. did you perchance try commenting everything out (in your portals.nix module) and leaving just the…

xdg.portal.enable = true;

anyhoo, what do these little guys say (in shell):

xdg-open about:blank
xdg-mime query default x-scheme-handler/https

(link)

xdg-mime query default text/html

(file)

cos, like, for me, xdg.portal.xdgOpenUsePortal was breaking things, such as links! :crazy_face:

and i also remember having problems with MIME, where i completely ruined the associations and it didnt know what anything was (apps couldnt “communicate” with each other)!

and, umm, i have this in my config just in case:

xdg.mime.defaultApplications = {
  "x-scheme-handler/http" = "librewolf.desktop";
  "x-scheme-handler/https" = "librewolf.desktop";
};

(or whatever browser)

oh, and, btw, some of the stuff in your config is kinda outdated/legacy…

1 Like

I think you might be over-complicating it. Is there a reason you can’t just have withUWSM set to true?

I can run

nix-shell -p glib --run 'gdbus call --session --dest=org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method=org.freedesktop.portal.OpenURI.OpenURI "" https://www.google.com "{}"'

just fine, and I have no explicit portal setup.

I am running nixos-unstable, specifically nixos-25.11pre866707.e643668fd71b, and my entire hyprland.nix looks like:

{
  config,
  lib,
  pkgs,
  ...
}:

{
  programs.hyprland = {
    enable = true;
    xwayland.enable = true;
    withUWSM = true;
  };

  services.hypridle.enable = true;
  programs.hyprlock.enable = true;

  environment.etc = {
    "xdg/hypr/hypridle.conf".text = ''
      listener {
        timeout = 330 # seconds
        on-timeout = hyprctl dispatch dpms off
        on-resume = hyprctl dispatch dpms on
      }
    '';
  };

  environment.sessionVariables = {
    HYPR_PLUGIN_DIR = pkgs.symlinkJoin {
      name = "hyprland-plugins-path";
      paths = with pkgs.hyprlandPlugins; [
        hyprscrolling
      ];
    };
  };

  environment.systemPackages =
    with pkgs;
    [
      hyprcursor # new cursor format
      rose-pine-hyprcursor # more normal cursor
      wofi # runner
      kitty # terminal used in default config
      hyprpaper
      hyprpicker
      hyprsunset # "Sunset" filter/reddish screen tint that will not get captured by screen recorders
      hyprpolkitagent # allows GUI to request elevated privileges
      # brightnessctl # env-agnostic tool for controlling non-external monitor brightness
    ]
    ++ [
      hyprlandPlugins.hyprscrolling
    ];

  programs.waybar.enable = true;

}

I also don’t even want to know why you have 4 copies of nixpkgs in your flake.lock.

1 Like

This works! Thank you!! This, and frozen.frog23’s suggestion of:

Seems to (separately) fix the issue. I’ve opted for the withUWSM = true; because I can just remove the portals module entirely. As for why my flake has 4 nixpkgs, I honestly can’t tell you, because my flake is a mishmash of a bunch of different flakes that I found around. I will be looking into it, Thanks again!

1 Like