xdg-desktop-portal-gtk icon indicating copy to clipboard operation
xdg-desktop-portal-gtk copied to clipboard

Default application from host environment is ignored, "Open With" doesn't always show.

Open pklapperich opened this issue 1 year ago • 0 comments

Using Flatpak 1.15.4, xdg-desktop-portal-gtk 1.14.1-1, and xdg-desktop-portal 1.16.0-3. The only Flatpak app I have right now is LibreOffice org.libreoffice.LibreOffice 7.5.4.2 and its dependencies. My desktop environment is XFCE4 4.18.1-1.

My default application for application/pdf on the host environment is master pdf:

$ xdg-mime query default application/pdf
masterpdfeditor4.desktop

From inside the flatpak, no default is reported:

$ flatpak run --command=sh org.libreoffice.LibreOffice
$ gio mime application/pdf
No default applications for “application/pdf”

Both xdg-desktop-portal and xdg-desktop-portal-gtk user services are running (or if not, start immediately when I click links).

I assume this is all normal so far.


The weirdness started when I first tried opening a file://blah.pdf URL from libreoffice calc. Initially I was shown the Open With dialog every time I clicked a link to a PDF. Eventually I was never shown the Open With dialog and it was opening with Okular, even though my default in XFCE is set to Master PDF.

image


Steps to Reproduce

  1. On the host, remove the desktop-used-apps "permission" for PDFs from libreoffice: flatpak permission-remove desktop-used-apps application/pdf org.libreoffice.LibreOffice
  2. ctrl+click a link in LibreOffice Calc and the Open With dialog opens with MasterPDF selected, which is the default app according to XDG on the host environment.
  3. Select double click any app or select an app and click "OK" to launch with that app.
  4. Repeat steps 2-3 until bored. Everything normal here.
  5. select okular and click ok (or double click okular).
  6. okular opens the file.
  7. ctrl+click in libreoffice again and the dialog opens with Okular selected
  8. select master pdf (or gimp or firefox) and then double click okular.
  9. okular opens the file.
  10. Ctrl+click in libreoffice again and okular opens the file without showing the Open With dialog.

Okular is now used as the default from LibreOffice regardless of what's set as the default in the host environment. This remains until step 1 is repeated.

Additional Observations After steps 3 and 5 the desktop-used-apps permission for PDFs is changed on the libreoffice package. I understand that's correct and expected.

Expected Behaviors

  • a weird combination of actions shouldn't make something behave as the default app
  • there is a default app in the host environment, that should be used what's used. I don't think the Open With dialog should ever be shown, should it?

pklapperich avatar Jul 20 '23 19:07 pklapperich