You are not logged in.

#1 2023-10-29 20:56:07

E3FxGaming
Member
Registered: 2023-10-29
Posts: 3

[SOLVED] xdg-portals OpenURI on XFCE / open links from Flatpak app

Not sure if it's ok to post about things I've already solved myself, but maybe it saves someone else the trouble of having to figure it out.

I'm new to Arch Linux, so I wanted to install the Spotify Flatpak version. Installing Spotify went fine (installed the flatpak package with pacman then used (plasma-)discover to install the Spotify Flatpack package).

When you run the Spotify Flatpak version, you're greeted by a button that should open your standard (potentially non-flatpak) web browser, where you log into Spotify, which in turn progresses the Spotify Flatpak application and lets you listen to music.

Clicking the button initially did nothing for me, except tell me in the Spotify Flatpak application that I should proceed in my browser and if it doesn't work I should try again with a retry button (running a XFCE desktop environment).

Running the Spotify Flatpak application from the terminal with

flatpak run --log-session-bus com.spotify.Client

allowed me to figure out that it tried to send

org.freedesktop.portal.OpenURI.OpenURI

through D-Bus, however no handler was registered for handling this function call.

Solution for my problem:

  1. I had to install xdg-desktop-portal (main runner of Flatpak related D-Bus activity), xdg-desktop-portal-xapp (takes care of my XFCE specific Flatpak D-Bus tasks, but does not implement OpenURI) and xdg-desktop-portal-gtk (implements many things for GTK, including OpenURI) with

    pacman -Suy xdg-desktop-portal xdg-desktop-portal-xapp xdg-desktop-portal-gtk
  2. I then had to go to /usr/share/xdg-desktop-portal/, remove the default gtk-portals.conf and xapp-portals.conf files and add a new xfce-portals.conf file. The naming of the new file is important, since the old default files used a deprecated UseIn config to identify the desktop environment, while the new file is applicable to XFCE environements because of its filename. This Github comment and the portals.conf man page, the portals.conf documentation, as well as the XDG Desktop Portal ArchWiki page helped a lot.

  3. I then had to put the following in the new xfce-portals.conf file

    [preferred]
    default=xapp;gtk

    This tells xdg-desktop-portal that it should prefer the XFCE specific portal (defined in /usr/share/xdg-desktop-portal/portals/xapp.portal) for requests, but if that one doesn't want to resolve a request resolution though the GTK portal (/usr/share/xdg-desktop-portal/portals/gtk.portal) is alright too.

  4. Lastly I had to check with

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

    that the required systemd services were running (start them with

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

    if necessary) and restart the Spotify Flatpak application => this time clicking the button did open the Spotify login website.

I also used

xdg-settings get default-web-browser

to check the default web-browser (was set to customBrowser.desktop or something similar) and

xdg-settings set default-web-browser firefoxdeveloperedition.desktop

to fix that setting, though I don't know if it's actually related to fixing the problem.

Anyways, it works for me now and maybe it helps someone else in the future. The general solution is also applicable to other desktop environments, just have to install a different desktop environment specific xdg-desktop-portal package (refer to the ArchWiki page and package descriptions), create a different .conf file (check your desktop environment with

echo $XDG_CURRENT_DESKTOP

=> the filename is the output of that command in lowercase characters + "-portals.conf") and then set a different default portal name (check /usr/share/xdg-desktop-portal/portals/ for available portals, the name that goes in the file after "default=" is the portal file name without the .portal extension).

Last edited by E3FxGaming (2023-11-13 09:14:16)

Offline

#2 2023-10-29 21:33:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,299

Re: [SOLVED] xdg-portals OpenURI on XFCE / open links from Flatpak app

Just curious, why not the version of Spotify in extra (spotify-launcher), or the one in the AUR (spotify)?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2023-11-09 10:19:44

E3FxGaming
Member
Registered: 2023-10-29
Posts: 3

Re: [SOLVED] xdg-portals OpenURI on XFCE / open links from Flatpak app

ewaller wrote:

Just curious, why not the version of Spotify in extra (spotify-launcher), or the one in the AUR (spotify)?

Thanks for the suggestions. I had to get the xdg-portal things to work for Flatpak Discord anyways and I was already familiar with Flatpak Spotify, therefore I did not consider that I could install Spotify without Flatpak.

Offline

Board footer

Powered by FluxBB