Open external application with a url scheme in Firefox snap version

Sure, I hide the absolute path which contains the information of my home directory.

We find only one instance of frogansplayer.desktop in the system:

$ sudo find / -name frogansplayer.desktop -type f 2> /dev/null
[sudo] password for ****: 
/home/****/.local/share/applications/frogansplayer.desktop

Since you’re on Ubuntu with Gnome, could you please ensure the xdg-desktop-portal-gnome package is installed, it looks like it probably is and should be by default, but it’s worth double checking.

sudo apt install xdg-desktop-portal-gnome

Well ! @wylink .

Let’s see the output of this command :

gio mime x-scheme-handler/leaptofrogans

Hello @James-Carroll

Yes, I have re-installed it several times. Here is the installed packages:

$ dpkg -l | grep 'xdg\|snap'
rc  chromium-browser                           1:85.0.4183.83-0ubuntu2.22.04.1             amd64        Transitional package - chromium-browser -> chromium snap
ii  firefox                                    1:1snap1-0ubuntu2                           amd64        Transitional package - firefox -> firefox snap
ii  firefox-locale-en                          1:1snap1-0ubuntu2                           all          Transitional package - firefox-locale-en -> firefox snap
ii  gir1.2-snapd-1:amd64                       1.60-0ubuntu1                               amd64        Typelib file for libsnapd-glib1
ii  gnome-software-plugin-snap                 41.5-2ubuntu2                               amd64        Snap support for GNOME Software
ii  libsnapd-glib1:amd64                       1.60-0ubuntu1                               amd64        GLib snapd library
ii  libsnappy1v5:amd64                         1.1.8-1build3                               amd64        fast compression/decompression library
rc  plasma-discover-backend-snap               5.24.7-0ubuntu0.1                           amd64        Discover software management suite - Snap backend
ii  python3-xdg                                0.27-2                                      all          Python 3 library to access freedesktop.org standards
ii  snapd                                      2.61.3+22.04                                amd64        Daemon and tooling that enable snap packages
ii  xdg-dbus-proxy                             0.1.3-1                                     amd64        filtering D-Bus proxy
ii  xdg-desktop-portal                         1.14.4-1ubuntu2~22.04.1                     amd64        desktop integration portal for Flatpak and Snap
ii  xdg-desktop-portal-gnome                   42.1-0ubuntu1                               amd64        GNOME portal backend for xdg-desktop-portal
ii  xdg-desktop-portal-gtk                     1.14.0-1build1                              amd64        GTK+/GNOME portal backend for xdg-desktop-portal
ii  xdg-desktop-portal-kde                     5.24.7-0ubuntu0.1                           amd64        backend implementation for xdg-desktop-portal using Qt
ii  xdg-user-dirs                              0.17-2ubuntu4                               amd64        tool to manage well known user directories
ii  xdg-user-dirs-gtk                          0.10-3build2                                amd64        tool to manage well known user directories (Gtk extension)
ii  xdg-utils                                  1.1.3-4.1ubuntu3~22.04.1                    all          desktop integration utilities from freedesktop.org

My concern looking at that list is that there’s both -kde and -gnome alongside each other. The 1.14 versions of the portals will pick one or the other and can’t mix and match (from what I believe, since I’ve read this is improved in 1.18). Technically they can work in the wrong environment, but it’d potentially open up issues like this.

Can you confirm the distribution version you’re running this on? The opening post says 23.10 but the package lists suggests 22.04, 23.10 should already be on 1.18.

My suggestion here would be to try to purge the xdg-desktop-portal packages and then reinstall them fresh focusing on just the xdg-desktop-portal-gnome package itself, so that the config isn’t split between KDE-isms and Gnome-ism’s.

Hello @baldeuniversel

Indeed, it is strange. the MIME type has neither registered applications nor recommended applications. Maybe that is the problem.

$ gio mime x-scheme-handler/leaptofrogans
Default application for “x-scheme-handler/leaptofrogans”: frogansplayer.desktop
No registered applications
No recommended applications

I have just checked the output of this command on Kubuntu where the Firefox snap version can open the external application. It’s the same output for the above command.

Well @wylink .

You can follow the @James-Carroll scenario. Otherwise, we can attempt to install/config our own mime .

And if you do this :

gio mime application/leaptofrogans

Thank you @James-Carroll and @baldeuniversel I will try it tonight.

2 Likes

Okay, @wylink .

You’re welcome.

1 Like

Hello @James-Carroll Ok, I have purged the xdg-desktop-portal and re-install it. But the problem remains.

$ dpkg -l | grep 'xdg\|snap'
rc  chromium-browser                           1:85.0.4183.83-0ubuntu2.22.04.1             amd64        Transitional package - chromium-browser -> chromium snap
ii  firefox                                    1:1snap1-0ubuntu2                           amd64        Transitional package - firefox -> firefox snap
ii  firefox-locale-en                          1:1snap1-0ubuntu2                           all          Transitional package - firefox-locale-en -> firefox snap
ii  gir1.2-snapd-1:amd64                       1.60-0ubuntu1                               amd64        Typelib file for libsnapd-glib1
ii  gnome-software-plugin-snap                 41.5-2ubuntu2                               amd64        Snap support for GNOME Software
ii  libsnapd-glib1:amd64                       1.60-0ubuntu1                               amd64        GLib snapd library
ii  libsnappy1v5:amd64                         1.1.8-1build3                               amd64        fast compression/decompression library
rc  plasma-discover-backend-snap               5.24.7-0ubuntu0.1                           amd64        Discover software management suite - Snap backend
ii  python3-xdg                                0.27-2                                      all          Python 3 library to access freedesktop.org standards
ii  snapd                                      2.61.3+22.04                                amd64        Daemon and tooling that enable snap packages
ii  xdg-dbus-proxy                             0.1.3-1                                     amd64        filtering D-Bus proxy
ii  xdg-desktop-portal                         1.14.4-1ubuntu2~22.04.1                     amd64        desktop integration portal for Flatpak and Snap
ii  xdg-desktop-portal-gnome                   42.1-0ubuntu1                               amd64        GNOME portal backend for xdg-desktop-portal
ii  xdg-desktop-portal-gtk                     1.14.0-1build1                              amd64        GTK+/GNOME portal backend for xdg-desktop-portal
ii  xdg-user-dirs                              0.17-2ubuntu4                               amd64        tool to manage well known user directories
ii  xdg-user-dirs-gtk                          0.10-3build2                                amd64        tool to manage well known user directories (Gtk extension)
ii  xdg-utils                                  1.1.3-4.1ubuntu3~22.04.1                    all          desktop integration utilities from freedesktop.org

Hello @baldeuniversel

$ gio mime application/leaptofrogans
No default applications for “application/leaptofrogans”

I don’t think it is about application MIME type.

Hello,

If I manually add a line under the [Added Associations] in .config/mimeapps.list as below, the Firefox can open correctly the associated external application if we click on the corresponding URL Scheme link.

[Added Associations]
x-scheme-handler/leaptofrogans=frogansplayer.desktop

And the following command gives also the good registered and recommanded applications:

$ gio mime x-scheme-handler/leaptofrogans
Default application for “x-scheme-handler/leaptofrogans”: frogansplayer.desktop
Registered applications:
	frogansplayer.desktop
Recommended applications:
	frogansplayer.desktop

Hello ! @wylink .

This seems like a good alternative.

@wylink ! Personally, I would be tempted to create a file of type leaptofrogans.xml like this :

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
    <mime-type type="application/leaptofrogans">
        <comment>Frogans ...</comment>
        <glob pattern="*.frog"/>
    </mime-type>
</mime-info>

Then :

xdg-mime install --mode system leaptofrogans.xml

or

xdg-mime install --mode user leaptofrogans.xml

Then :

xdg-mime default firefox.desktop application/leaptofrogans

@wylink ! With the output you pasted here, you can already do this to conclude :slightly_smiling_face:.

xdg-mime    default    firefox.desktop    x-scheme-handler/leaptofrogans

Thank you for your proposal @baldeuniversel. The last command is trying to associate leaptofrogans with firefox. That is not exactly what I am trying to do. I need to associate the URI scheme leaptofrogans with its corresponding application (named frogans player), and which can be opened whenever we click on URI scheme link on a web page with any web browser.

xdg-mime default firefox.desktop application/leaptofrogans

Hello @baldeuniversel

Do you mean?

xdg-mime    default    frogansplayer.desktop    x-scheme-handler/leaptofrogans

The above command, however, add only a line under [Default Applications] section in mimeapps.list. I should also add manually the line under [Added Associations] section in my case.

[Added Associations]
x-scheme-handler/leaptofrogans=frogansplayer.desktop

[Default Applications]
x-scheme-handler/leaptofrogans=frogansplayer.desktop

Oops, I think we weren’t aligned on the same plan. I summarize everything, you want to set up a config which will allow you, based on a pattern, to open from anywhere (the content with) a program called Frogans player which is installed on your system, that’s it @wylink :slightly_smiling_face:?

Might be a silly one but I’d looked at the screenshot above and the webpage they’re hosted on, can you try the url with explicitly leaptofrograns:// I.E making sure to include the //.

leaptofrogans://frogans*demo-Tennis-Live