Firefox and XDG Portal

Hi all,

This might not have anything to do with Manjaro. In fact, I’m fairly certain it doesn’t.

However, it is something I’ve been trying to sort out ever since I installed Manjaro. I don’t think it was an issue when I used Ubuntu, as it is GTK, while when using Manjaro I’ve decided to stick with Qt and KDE from now.

But, unfortunately, Firefox’s dialogs are still GTK. I’ve followed this on the Arch Wiki, numerous times:

https://wiki.archlinux.org/title/Firefox#XDG_Desktop_Portal_integration

To no long-term effect. Even, with:

https://i.imgur.com/E6rcCDs.png

And

$ systemctl --user status plasma-xdg-desktop-portal-kde.service
● plasma-xdg-desktop-portal-kde.service - Xdg Desktop Portal For KDE
     Loaded: loaded (/usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service; static)
     Active: active (running) since Thu 2024-09-12 08:27:35 SAST; 12min ago
 Invocation: e735fccafb734bc4a9b38adf9dc10940
   Main PID: 78613 (xdg-desktop-por)
      Tasks: 3 (limit: 18953)
     Memory: 16.6M (peak: 17.6M)
        CPU: 213ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-xdg-desktop-portal-kde.service
             └─78613 /usr/lib/xdg-desktop-portal-kde

Sep 12 08:27:35 Mirdarthos-PC systemd[1022]: Starting Xdg Desktop Portal For KDE...
Sep 12 08:27:35 Mirdarthos-PC systemd[1022]: Started Xdg Desktop Portal For KDE.

Neither the Save or Open dialogs ever open in Firefox. If I set the widget.use-xdg-desktop-portal.* to 2 in Firefox, a GTK dialog box pops up.

While none of this is life-threatening, it is very annoying, and I don’t know if there is anything else I could do, so I’d like to ask you smart people if you perhaps have any ideas as to what’s causing this, and/or how to fix it. Additional info:

$ systemctl --user status xdg-desktop-portal.service
● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Thu 2024-09-12 08:51:02 SAST; 1min 58s ago
 Invocation: 69874f175f1a4c5f92446bdedf1e197c
   Main PID: 79873 (xdg-desktop-por)
      Tasks: 6 (limit: 18953)
     Memory: 5.5M (peak: 6.3M)
        CPU: 80ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─79873 /usr/lib/xdg-desktop-portal

Sep 12 08:51:02 Mirdarthos-PC systemd[1022]: Stopped Portal service.
Sep 12 08:51:02 Mirdarthos-PC systemd[1022]: xdg-desktop-portal.service: Consumed 1.378s CPU time, 9.7M memory peak.
Sep 12 08:51:02 Mirdarthos-PC systemd[1022]: Starting Portal service...
Sep 12 08:51:02 Mirdarthos-PC xdg-desktop-por[79873]: Choosing kwallet.portal for org.freedesktop.impl.portal.Secret via the deprecated UseIn key
Sep 12 08:51:02 Mirdarthos-PC xdg-desktop-por[79873]: The preferred method to match portal implementations to desktop environments is to use the portals.conf(5) configuration file
Sep 12 08:51:02 Mirdarthos-PC systemd[1022]: Started Portal service.

I don’t know if this is important for some reason, but:

$ systemctl --user status xdg-document-portal.service
● xdg-document-portal.service - flatpak document portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-document-portal.service; static)
     Active: active (running) since Thu 2024-09-12 08:54:24 SAST; 24s ago
 Invocation: 6e9f3f02dbee47f4a93eda81add8cf34
   Main PID: 80114 (xdg-document-po)
      Tasks: 8 (limit: 18953)
     Memory: 5.2M (peak: 5.8M)
        CPU: 11ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-document-portal.service
             ├─80114 /usr/lib/xdg-document-portal
             └─80123 fusermount3 -o rw,nosuid,nodev,fsname=portal,auto_unmount,subtype=portal -- /run/user/1000/doc

Sep 12 08:54:24 Mirdarthos-PC systemd[1022]: Stopped flatpak document portal service.
Sep 12 08:54:24 Mirdarthos-PC systemd[1022]: Starting flatpak document portal service...
Sep 12 08:54:24 Mirdarthos-PC systemd[1022]: Started flatpak document portal service.

And

$ systemctl --user status xdg-desktop-autostart.target
○ xdg-desktop-autostart.target - Startup of XDG autostart applications
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-autostart.target; static)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

And:

$ systemctl --user status xdg-user-dirs-update.service xdg-permission-store.service
○ xdg-user-dirs-update.service - Update XDG user dir configuration
     Loaded: loaded (/usr/lib/systemd/user/xdg-user-dirs-update.service; enabled; preset: enabled)
     Active: inactive (dead) since Wed 2024-09-11 09:10:48 SAST; 23h ago
 Invocation: 7cd5fbadaba34ef5a0b5b68f68405bce
       Docs: man:xdg-user-dirs-update(1)
   Main PID: 1036 (code=exited, status=0/SUCCESS)
   Mem peak: 1.4M
        CPU: 4ms

Sep 11 09:10:48 Mirdarthos-PC systemd[1022]: Starting Update XDG user dir configuration...
Sep 11 09:10:48 Mirdarthos-PC systemd[1022]: Finished Update XDG user dir configuration.

● xdg-permission-store.service - sandboxed app permission store
     Loaded: loaded (/usr/lib/systemd/user/xdg-permission-store.service; static)
     Active: active (running) since Wed 2024-09-11 09:10:49 SAST; 23h ago
 Invocation: e39428ff16b7404ab40b4d3909342666
   Main PID: 1088 (xdg-permission-)
      Tasks: 4 (limit: 18953)
     Memory: 764K (peak: 3.2M zswap: 1.2K)
        CPU: 7ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-permission-store.service
             └─1088 /usr/lib/xdg-permission-store

Sep 11 09:10:49 Mirdarthos-PC systemd[1022]: Starting sandboxed app permission store...
Sep 11 09:10:49 Mirdarthos-PC systemd[1022]: Started sandboxed app permission store.

Any advice would be welcome.

These are my Firefox xdg settings that work fine on Plasma:

widget.use-xdg-desktop-portal.file-picker	1	
widget.use-xdg-desktop-portal.location	2	
widget.use-xdg-desktop-portal.mime-handler	1	
widget.use-xdg-desktop-portal.open-uri	2	
widget.use-xdg-desktop-portal.settings	2

Also, do you have the plasma-integration & plasma-browser-integration packages installed?

plasma-browser-integration also requires the following add-on to be installed in Firefox:

1 Like

It seems so:

$ pamac search -i plasma-browser-integration
plasma-browser-integration  6.0.5-1                                                                                                                                                                                             extra
Components necessary to integrate browsers into the Plasma Desktop

$ pamac search -i plasma-integration
plasma-integration  6.0.5-1                                                                                                                                                                                                     extra
Qt Platform Theme integration plugins for the Plasma workspaces

It is installed.

Just set these to the same values, and it seemed to do the trick. But, I don’t know why. But,

:man_shrugging:

I’ll check thorough the day and if it continues to work, I’ll mark the solution.

1 Like

Is there something simular for Mozilla’s Thunderbird email client ? I see the same problem there, but can not find any plasma extention…
Thanks !
Greetings, Eddy

I’ve found

GTK_USE_PORTAL=1 firefox

works. But… For some reason (it may just be something about my system) the portal doesn’t work properly after my Plasma session starts, so before launching Firefox, I have to do:

systemctl --user restart xdg-desktop-portal
systemctl --user restart plasma-xdg-desktop-portal-kde

I just wrap all this up in a Firefox starter script.

1 Like

Thank you, you brought me on the right track. I put export GTK_USE_PORTAL=1 in my user .profile and rebooted. Problem solved for Thunderbird also now…
Greetings,
Eddy

In firefox open about:config

Search for widget.use

Then change the value from auto to forced (change 2 to 1)

1 Like
  1. Check you have xdg-desktop-portal, xdg-desktop-portal-kde and xdg-desktop-portal-gtk installed

  2. In Firefox about:config page set widget.use-xdg-desktop-portal.file-picker to 1

  3. Reboot

If it doesn’t work try to:

  • Reset Firefox settings then apply step 2
  • It’s recommended to remove GTK_USE_PORTAL=1 from your environment