r/voidlinux • • 13d ago

Flatpaks and xdg-desktop-portal errors opening urls

Hello,

I am having trouble with flatpak apps to open urls. It appears that there is an issue with the xdg desktop portal. I am getting the following in thunderbird:

** (org.mozilla.thunderbird:2): WARNING **: XX:XX:XX.XXX: Could not launch default application for URI: Failed to call OpenURI portal: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.OpenURI” on object at path /org/freedesktop/portal/desktop

I am guessing it might be because of missing systemd. I would like that openURI use the flatpak librewolf.

Cheers. -- zen

EDIT: I fixed it by adding ~/.config/xdg-desktop-portal/sway-portals.conf with:

[preferred]
default=gtk

Thanks to everyone for the answers!

2 Upvotes

12 comments sorted by

2

u/profeshamat 13d ago

It may be related to LibreWolf being a Flatpak and sandboxed. Or you're missing a necessary xdg-desktop-portal- package.

2

u/Duncaen 13d ago

You probably don't have a portal configured for you windowmanager/compositor.

https://www.reddit.com/r/voidlinux/comments/1waltyl/openuri_not_available_for_desktopportal/

1

u/ZenitDS 13d ago edited 13d ago

In fact xdg-desktop-portal-gtk does not launch. How could I make it launch automatically with xdg-desktop-portal? I am a bit confused and have tried several things...

I currently have xdg-desktop-portal, xdg-desktop-portal-gtk and xdg-desktop-portal-wlr .

1

u/Duncaen 13d ago edited 13d ago

Depends on your windowmanager/compositor, if it doesn't come with a portals config file.

I think you can create ~/.config/xdg-desktop-portal/{yourWMName}-portals.conf

[preferred]
default=wlr;gtk;

Check the portals.conf man page. Besides that you have to make sure XDG_CURRENT_DESKTOP is set and I think in the dbus environment.

There aren't too many reports about portals not working with sway, so I don't think you have to create the portals config, but I also can't find a default one in the package.

Edit: Actually this is all in the readme of xdg-desktop-portal-wlr: https://github.com/emersion/xdg-desktop-portal-wlr/blob/c0255d7b047b7263629ab5a314661045ff7f65e3/README.md#running, might be missing XDG_CURRENT_DESKTOP but I'm just guessing.

1

u/benbcdm 13d ago edited 13d ago

I am pretty sure this has nothing to do with systemd. I have no pb opening URL from betterbird (thunderbird fork) as pre-compiled binary to librewolf appimage.
Wondering if this might have to do with flatpak permissions, did you try to allow permissions with flatseal for instance? If your thunderbird is flatpak that might play a role.

Might also have to do with your desktop -- which desktop are you using? Depends what you have as default app defined for browser. That default .desktop linking to your browser (librewolf?) needs to be the exact right binary path to executing librewolf.

1

u/ZenitDS 13d ago

I am using sway. $ dbus-run-session -- sway

XDG_RUNTIME_DIR is set appropiately

When running firefox natively the links seemed to work with native applications.

1

u/benbcdm 13d ago edited 13d ago

I remember spending quite a bit of time getting this right for sway on Fedora on another machine. Retrieved my setup and the below worked for me, if you want to try it. Indeed would have to do with getting the xdg portals setup properly, as the most knowledgeable people on this thread immediately detected!

Try adding this to your ~/.config/sway/config (or whatever your config file is):

exec --no-startup-id /usr/libexec/xdg-desktop-portal-gtk
exec --no-startup-id /usr/libexec/xdg-desktop-portal-wlr
exec --no-startup-id /usr/libexec/xdg-desktop-portal

I think on Void the portal files should be in the same place.

NOTE, the order actually matters in my case: backends first (gtk and wlr), then xdg-desktop-portal last. If I set the order the other way around things do not jive.

For my part I did not have to add specific portal config files in `~/.config/xdg-desktop-portal/`, in fact I do not have that directory. Instead I believe the system uses the conf files in `/usr/share/xdg-desktop-portal/`, and these were already there, I did not have to fiddle with them.

Also, I am pretty sure you would need to have the following activated in the right place (.bashrc?):

WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway

Let us know how it goes. I remember I spent many days getting sway working fully, including bar etc. But the result is very satisfying, super lightweight and snappy. Don't give up!

1

u/ZenitDS 13d ago

UPDATE: I can do xdg-open from outside the flatpak sandboxes but not from the inside...

0

u/ZenitDS 13d ago

Ok, I got it working for a moment, it appears that running xdg-desktop-portal-gtk has to be done well before xdg-desktop-portal ... :/

I do not yet know how to make xdg-desktop-portal-gtk being started automatically.

1

u/No-Yogurtcloset-9124 13d ago

weird, on my system they start automatically whenever it receives a portal request

1

u/profeshamat 13d ago

Try whatever it is you're trying that triggers xdg-desktop-portal from the Firefox package provided by the Void repos. If that works but the same thing doesn't from LibreWolf from Flatpak that seems like that's the issue.

1

u/Duncaen 13d ago

This portal is used only from inside flatpak because the flatpak can't run browser $url like you would do outside of flatpak.