toolbox icon indicating copy to clipboard operation
toolbox copied to clipboard

xdg-open not working

Open A6GibKm opened this issue 6 years ago • 8 comments

This is a continuation of #147, at the moment xdg-open is not working as intended,

$ /usr/bin/xdg-open somepdf.pdf 

gio: file:somepdf.pdf: No application is registered as handling this file
/usr/bin/xdg-open "https://www.google.cl"

gio: https://www.google.cl: Operation not supported

The expected behaviour should be to open using the host default application, a possible fix is to create a xdg-open script in your path with contents

#!/bin/sh
${TOOLBOX_PATH:+flatpak-spawn --host} /usr/bin/xdg-open "$@"

A6GibKm avatar Oct 09 '19 19:10 A6GibKm

So, if I understand it correctly, from #147, the flatpak-spawn method is the intended solution (even though it was split from flatpak, the name is just for historical purposes). I guess this script would have to be dropped in the image somewhere where it can override the builtin xdg-open.

jdloft avatar Feb 05 '20 18:02 jdloft

Having this script in the image would prevent a lot of headaches. I currently ran into this issue when trying to open links from VS Code running inside Toolbox. I'm happy to submit a PR if we can figure out where it should live.

poita66 avatar Jan 13 '21 01:01 poita66

This should work by default if toolbox is to be the required tool to do development work in a Fedora Silverblue or similar immutable systems. Many web development tools launch a browser when building, for example, and right now using toolbox with those tools throws really strange errors.

I am using the fix specified in the body of this issue, and it works for me, so at least a workaround is possible. Said that, I think it is pretty necessary for this to work by default.

adrm avatar Jun 01 '21 12:06 adrm

flatpak-xdg-open does work inside Toolbox, so the alternative fix is to use flatpak-xdg-utils as a drop-in replacement for xdg-utils specifically for Toolbox.

lukateras avatar Oct 21 '21 20:10 lukateras

For anyone still interested in this, here's my workaround (tested on Fedora Silverblue 35):

[yana@host ~]$ toolbox enter
[yana@toolbox ~]$ sudo dnf install flatpak-xdg-open
[yana@toolbox ~]$ sudo ln -s /usr/bin/flatpak-xdg-open /usr/bin/xdg-open

lukateras avatar Oct 21 '21 20:10 lukateras

For anyone still interested in this, here's my workaround (tested on Fedora Silverblue 35):

[yana@host ~]$ toolbox enter
[yana@toolbox ~]$ sudo dnf install flatpak-xdg-open
[yana@toolbox ~]$ sudo ln -s /usr/bin/flatpak-xdg-open /usr/bin/xdg-open

in Fedora Silverblue 39 this packages is called flatpak-xdg-utils now. Just in case someone has trouble to find it.

616b2f avatar Jan 29 '24 09:01 616b2f

So we have a functioning workaround but not a proper upstream fix for it so far. Let me propose the following

Update the Fedora 39 container image

  1. Add flatpak-xdg-utils to the extra-packages file of the container image
  2. Link /usr/bin/xdg-open to /usr/bin/flatpak-xdg-open in the container file

~~There is however one thing I am not certain about. What happens when the xdg-utils package inside of the container gets updated, e.g. through sudo dnf upgrade. Does it overwrite /usr/bin/xdg-open and thus the link is gone?~~

The above concern is irrelevant, because the xdg-utils is not installed by default on the Fedora 39 image.

On a site note: Does it make sense to make this issue part of Project Pickle?

notfirefox avatar Feb 19 '24 09:02 notfirefox