Link in flatpak apps won't open on click since anymore last update

I had this issue too: clicking on links in flatpak apps wouldn’t open in my default browser, also the file manager wouldn’t open (like in Warehouse in case of “Open User Data Folder”)

Troubleshooting:

flatpak run --log-session-bus your.installed.flatpak.app.of.choice

Clicking on link or open mime inode/directory showed:

C13: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.OpenURI.OpenURI at /org/freedesktop/portal/desktop
B109: <- :1.39 return error org.freedesktop.DBus.Error.UnknownMethod from C13

Checked mime types were set:

gio mime inode/directory
gio mime x-scheme-handler/https
(those were set correctly in my case)

Gave them a go:

gio open https://forum.manjaro.org
(opened the URL as expected in my default browser)

The fix:

I made sure XDG_CURRENT_DESKTOP environment variable was set

echo $XDG_CURRENT_DESKTOP
XFCE
systemctl --user import-environment XDG_CURRENT_DESKTOP
systemctl --user show-environment

Made sure xdg-desktop-portal-gtk is installed

Added a new portals conf for XFCE

~/.config/xdg-desktop-portal/xfce-portals.conf

[preferred]
default=gtk;

Restarted services:

systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-gtk.service

Success, links finally opened in the default browser and file manager could be started by flatpak apps

Hope this helps.

1 Like

Similar methodology outlined here (i have no idea if you really want xapp to be the default?)

Thanks for the feedback. I’m really not an expert and hoped sharing my fix would result in either validation or constructive criticism. Xapp sounded like a good default for XFCE, its description says “A backend implementation for xdg-desktop-portal using GTK and various pieces of Cinnamon/MATE/Xfce4 infrastructure”. My understanding is, GTK is the fallback anyway? Should be ok, no?

I thought xfce used the gtk backend regularly. :person_shrugging:

I got GNOME on my notebook. That install didn’t have the issue discussed here, so I used its setup to reverse engineer the portal conf and backends. The GNOME portal conf uses “default=gnome;gtk;”, so I just followed that example and replaced gnome with xapp for the XFCE install.

xapp appears to be for screenshot/screencast ability on cinnamon.
(maybe you are thinking xapp=xfce because of x?)
https://wiki.archlinux.org/title/XDG_Desktop_Portal

Then again … it sorta looks like it on the flatpak/xdg-desktop-portal github page…

You will of course be in a better position to be sure :wink:

I looked through the github of xapp and it seems to do very little for XFCE. I tried xapp as the mere default and everything broke again, then I set GTK as mere default and everything worked as intended. I’m going to revise my fix up thread.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.

Hi,
I’m continuing here this topic Link in flatpak apps won't open anymore on click since last update since the original topic is closed and locked.

I would like to thank CrackalackingZ, I’m sorry for late answer, I didn’t noticed the topic was updated since I was very busy.

Your solution indeed did the trick. Thank you for sharing!

I also add some extra config.Since the systemd environment variable are reinitialized every time I boot, I loose the environment variable XDG_CURRENT_DESKTOP in my systemd environment variable.

To solve this issue I followed the section about systemd environment variable in archlinux wiki : systemd/User - ArchWiki

I created a ~/.config/environment.d/user.conf file in which I added the XDG_CURRENT_DESKTOP environment variable :

XDG_CURRENT_DESKTOP=XFCE

Then this environment variable is initialized every time my user is logging, and then everything works well.

Now when I click on links from flatpak apps, the links are opened in my browser :tada: :tada: :confetti_ball:

Thanks again for your answer, it allowed me to solve this painful issue

I do wonder why this would be continually unset though.

@ms34 I merged your new topic into the existing one and reopened it. If the current solution is still valid, then it will again automatically close 36 hours after the last reply.

2 Likes

Thank you @Yochanan , the solution is still valid and the extra information I brought can also be useful to other people facing the same problem. It’s indeed more useful here than in a separate extra topic

@CrackalackingZ Thank you again for the answer !

1 Like

I do wonder why this would be continually unset though.

It’s just maybe never set at boot or login

It’s good to have this fixes at hand, but maybe something should be done to negate the need for a manual fix in the first place.

I’m also using a GNOME install, it got the correct portal conf /usr/share/xdg-desktop-portal/portals/gnome.portal … although I have no idea, which package placed it there. I only recently setup a new notebook and definitely didn’t have to do this manually. It just worked out of the box.

Maybe it would be a good idea to have a xdg-desktop-portal-xfce package for XFCE to setup the required portal conf, environment variable and a dependency on xdg-desktop-portal-gtk?

No wonder you had issues. xdg-desktop-portal-xapp should only be installed on Cinnamon. On Xfce, one should only have xdg-desktop-portal-gtk.

Don’t install portals you don’t need. :wink:

xdg-desktop-portal-xapp was unnecessary, yes, but not the cause of the issue. That package comes with the bold’d portal conf below and it was never loaded.

/usr/lib/systemd/user/xdg-desktop-portal-xapp.service
/usr/lib/xdg-desktop-portal-xapp
/usr/share/applications/xdg-desktop-portal-xapp.desktop
/usr/share/dbus-1/services/org.freedesktop.impl.portal.desktop.xapp.service
/usr/share/xdg-desktop-portal/portals/xapp.portal
/usr/share/xdg-desktop-portal/xapp-portals.conf

xdg-desktop-portal-gtk by itself wasn’t doing the trick, its conf file /usr/share/xdg-desktop-portal/gtk-portals.conf wasn’t loaded either under XFCE. Setting XDG_CURRENT_DESKTOP=GTK might do, but going by the portal conf documentation, the prefix should be the desktop environment: portals.conf(5) — Arch manual pages

It looks like it was noticed by XFCE Add minimal xdg-desktop-portal conf file for Xfce (Fixes #181) (!47) · Merge requests · Xfce / xfce4-session · GitLab … but the Manjaro package xfce4-session seems not to have the mentioned xfce-portal.conf either

No, this should be XFCE if the desktop is xfce.
And I am still wondering why it is not set in that environment.
https://wiki.archlinux.org/title/Environment_variables#Examples

This is different from the portal conf file.
(which again should only be needed in the case of multiple portals and/or flatpaks as far as I can tell)

Just having the correct XDG_CURRENT_DESKTOP isn’t negating the need for the DE-portals.conf … at least from my testing:

I removed my portals conf, XDG_CURRENT_DESKTOP set correctly, ran test, it broke again:

~]$ mv ~/.config/xdg-desktop-portal/xfce-portals.conf ~/.config/xdg-desktop-portal/nope-portals.conf
~]$ systemctl --user show-environment | grep XFCE
XDG_CURRENT_DESKTOP=XFCE
~]$ systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-xapp.service xdg-desktop-portal-gtk.service
~]$ flatpak run --log-session-bus com.xnview.XnViewMP 
- Open URL from menu, problem is back:
C13: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.OpenURI.OpenURI at /org/freedesktop/portal/desktop
B44: <- :1.612 return error org.freedesktop.DBus.Error.UnknownMethod from C13

Then I restored the missing portals conf, ran test and it worked again:

~]$ mv ~/.config/xdg-desktop-portal/nope-portals.conf ~/.config/xdg-desktop-portal/xfce-portals.con
~]$ systemctl --user show-environment | grep XFCE
XDG_CURRENT_DESKTOP=XFCE
~]$ systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-xapp.service xdg-desktop-portal-gtk.service
~]$ flatpak run --log-session-bus com.xnview.XnViewMP 
- Open URL from menu, problem is solved again:
C13: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.OpenURI.OpenURI at /org/freedesktop/portal/desktop
B116: <- :1.617 return from C13
B119: <- :1.617 signal org.freedesktop.portal.Request.Response at /org/freedesktop/portal/desktop/request/1_620/t

EDIT: and while I’m at it, I also removed xapp to check if two portals mess with GTK doing its job without portals.conf , it appears xdg-desktop-portal-gtk also needs the portals conf to work:

~]$ pacman -Q | grep portal
xdg-desktop-portal 1.18.0-2
xdg-desktop-portal-gtk 1.15.1-1
~]$ mv ~/.config/xdg-desktop-portal/xfce-portals.conf ~/.config/xdg-desktop-portal/nope-portals.conf
~]$ systemctl --user show-environment | grep XFCE
XDG_CURRENT_DESKTOP=XFCE
~]$ systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-gtk.service
~]$ flatpak run --log-session-bus com.xnview.XnViewMP 
- Open URL from menu, problem is back:
C13: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.OpenURI.OpenURI at /org/freedesktop/portal/desktop
B33: <- :1.631 return error org.freedesktop.DBus.Error.UnknownMethod from C13

~]$ mv ~/.config/xdg-desktop-portal/nope-portals.conf ~/.config/xdg-desktop-portal/xfce-portals.conf
~]$ cat ~/.config/xdg-desktop-portal/xfce-portals.conf
[preferred]
default=gtk;
org.freedesktop.portal.OpenURI.OpenURI=gtk;
~]$ flatpak run --log-session-bus com.xnview.XnViewMP 
- Opened option to load file manager, thunar loaded :
C13: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.OpenURI.OpenFile at /org/freedesktop/portal/desktop
B94: <- :1.635 return from C13
B98: <- :1.635 signal org.freedesktop.portal.Request.Response at /org/freedesktop/portal/desktop/request/1_638/t

EDIT2:

Looks like peeps from other distros also found these issue:

https://bugzilla.redhat.com/show_bug.cgi?id=2249224

On the subject of “XDG_* environment variables don’t end up in the environment of processes started by dbus-daemon or systemd”

EDIT3

I wish I had found this issue tracker earlier:

Good read, straight from the horses’ mouths, TL;DR xfce-portals.conf IS needed now and will come with xfce4-session, mixing and matching portals IS valid, gtk covers most, but not everything, e.g. xapp is needed for screenshot and to set a wallpaper; xfce4-session will also ensure the various XDG_* env vars

EDIT4 … final fix until the stuff in EDIT3 is addressed:

This is for XFCE users only:

  • Install:

xdg-desktop-portal
xdg-desktop-portal-xapp
xdg-desktop-portal-gtk

  • Create ~/.config/environment.d/user.conf
    XDG_CURRENT_DESKTOP=XFCE

  • Create ~/.config/xdg-desktop-portal/xfce-portals.conf

[preferred]
default=gtk;
org.freedesktop.impl.portal.Wallpaper=xapp;gtk;
org.freedesktop.impl.portal.Screenshot=xapp;gtk;
  • Reboot … or restart the following services to make everything work:

systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-xapp.service xdg-desktop-portal-gtk.service

For gnome users what would be the procedure please?

B384: <- :1.484 return error org.freedesktop.DBus.Error.UnknownMethod from C24
Failed to call portal: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface ?org.freedesktop.portal.OpenURI? on object at path /org/freedesktop/portal/desktop

Solution for my case: reinstalled xdg-desktop-portal-gnome 45.0-1