Clicked links in desktop apps not opening browers

Hi there,

Is there anything special that needs to be done to allow things like clicking links in a desktop app (say Obsidian), or copying data?

I am having a few oddities where:

  • I try to click a link in obsidian, and it will not open in my browser
  • I try to login via my browser in the todoist app, and the browser just does not respond to the request

I am using Hyprland, and Chrome for my browsers.

Thank you.

EDIT - my nixos repo for reference.

I’m also using hyprland and am encountering the same issue.

What’s strange is I thought it was working… Going y check my xdg portal setup. I

'm also getting an error in the journal related to dconf cannot initialize due to missing symbol. Not sure what that is about

Depending on the app there are 2 root causes:

  1. xdg-portals aren’t set up properly
  2. you are using a DM that sets some env vars that confuse apps (especially xdg-open)
    (3. FF/Discord interaction has its own thing)

About 1, I have no clue, but it might help if you share at least WM and xdg-portal related configuration.

For 2, I have the following in my HM configuration, to unset what my DM does:

while I added a link to my repo on the original message, I will try and fill in what I did for xdg config.

  • added env vars:
export XDG_SESSION_TYPE="wayland"
export XDG_SESSION_DESKTOP="Hyprland"
export XDG_CURRENT_DESKTOP="Hyprland"
  • installed xdg-desktop-portal-hyprland
    • No options available in home-manager, or as options on the nixpkg itself are available
  • I can see it is running:
systemctl --user status xdg-desktop-portal-hyprland
● xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-hyprland.service; linked-runtime; preset: enabled)
     Active: active (running) since Wed 2023-06-14 10:10:23 PDT; 1h 50min ago
   Main PID: 2622 (.xdg-desktop-po)
      Tasks: 6 (limit: 77066)
     Memory: 14.4M
        CPU: 95ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal-hyprland.service
             └─2622 /nix/store/idr3ba4iivfknvcqfm6k6h92p4pbyyvh-xdg-desktop-portal-hyprland-0.4.0/libexec/xdg->

Jun 14 10:10:22 rembot systemd[2299]: Starting Portal service (Hyprland implementation)...
Jun 14 10:10:23 rembot systemd[2299]: Started Portal service (Hyprland implementation).

I am curious how you have yours configured and if you change anything. :+1:

Do you have those vers set in your shell as well? Does xdg-open do something sensible or does it just error out (or worse: fail silently)?

THey sure seem to be! :smiley:

☸ rke2 in ~ on ☁️  (us-west-2) at 08:01:47 

☸ rke2 in ~ on ☁️  (us-west-2) at 08:02:09 

☸ rke2 in ~ on ☁️  (us-west-2) at 08:02:17 

while i’m not grasping the full understanding of xdg. but xdg -desktop-portal-hyprland is from hyprland flake if you are using it.
better to avoid duplicates and not install it as a package

This is my home.nix

  home.sessionVariables = {
	    BROWSER = "google-chrome-beta";
	    TERMINAL = "kitty";
	    NIXOS_OZONE_WL = "1";
	    QT_SCALE_FACTOR = "1";
	    SDL_VIDEODRIVER = "wayland";
	    QT_QPA_PLATFORM = "wayland-egl";
	    WLR_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0";
	    WLR_NO_HARDWARE_CURSORS = "1"; # if no cursor,uncomment this line  
	    # GBM_BACKEND = "nvidia-drm";
	    CLUTTER_BACKEND = "wayland";
	    __GLX_VENDOR_LIBRARY_NAME = "nvidia";
	    LIBVA_DRIVER_NAME = "nvidia";
	    WLR_RENDERER = "vulkan";
	    XDG_CURRENT_DESKTOP = "Hyprland";
	    XDG_SESSION_DESKTOP = "Hyprland";
	    XDG_SESSION_TYPE = "wayland";
	    GTK_USE_PORTAL = "1";
	    XDG_CACHE_HOME = "\${HOME}/.cache";
	    XDG_CONFIG_HOME = "\${HOME}/.config";
	    XDG_BIN_HOME = "\${HOME}/.local/bin";
	    XDG_DATA_HOME = "\${HOME}/.local/share";

or you can export them directly in hyprland config file. but as they say not the “nix” way :melting_face:


Does xdg-open do something sensible or does it just error out (or worse: fail silently)?

yeah, I am installing it with the flake…

hyprland.url = "github:hyprwm/Hyprland";

# SNIP - Home Manager Import

So are you are saying to not install that package if I have installed it via a flake?

This might be part of the problem. That command does not exist on my system. I may have erroneously assumed that it would be bundled in with the hyprland specific package.

OK this was the solution. I had to install xdg-utils.

I’m wondering if I’m missing any other XDG related packages?

1 Like

yes thats in the flake xdg should be installed no need to install the package how ever u maybe need.

    xdg.portal = {
      enable = true;
      xdgOpenUsePortal = true;
      extraPortals = with pkgs; [
    wlr.enable = true;

im not sure if i do infact need to enable wlr and have it. but i do need gtk. forgot for what exactly.

my understanding of wlr - the hyperland version was a fork that added the hyprland specifics. I will try the other settings

I definitely had to install it. :man_shrugging:

Thats weird its mentioned in the wiki that if u use the flake you dont need to install it. can you check if the system is running it.

systemctl --user status xdg-desktop-portal-hyprland.service 

It is. :+1:

λ systemctl --user status xdg-desktop-portal-hyprland.service 
● xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementat>
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-hyprland.service; >
     Active: active (running) since Thu 2023-06-15 23:29:44 PDT; 8h ago

But I also added your previous code already.

yeah I did notice that aswell it doesnt seem to have a path in terminal for the portal but the system is running it. I noticed that I had multiple xdg-hyprland when I was trying to locate it. its why i commented it out in that code. I dont remember why i needed the gtk one but it was something similar to links in apps.

dont forget to garbage collect before locating it drove me crazy hahaha.

I believe with the gtk portal links in apps should work now

They started working once I installed xdg-utils. But I added these other config suggestions to mitigate future xdg-related misbehaviour.

Thank you to all who helped!