UnleashedRecomp icon indicating copy to clipboard operation
UnleashedRecomp copied to clipboard

Enable use of xdg-desktop-portal on linux flatpak builds

Open Jujstme opened this issue 9 months ago • 7 comments

This commit enables the use of the portal API for flatpak builds on linux: https://docs.flatpak.org/en/latest/portal-api-reference.html

Specifically for Unleashed Recompiled, this makes the installer use the native file dialog instead of the default gtk one.

As a collateral, this should fix https://github.com/hedge-dev/UnleashedRecomp/issues/553, as the file dialog will avoid using the gtk library altogether, on Plasma. I need the affected people to try this fix, however, as I am not able to reproduce the original bug consistently.

Jujstme avatar Mar 19 '25 19:03 Jujstme

I've tried this before and it didn't work on the Steam Deck in gaming mode. Have you tested it there?

DarioSamo avatar Mar 19 '25 19:03 DarioSamo

Installation in gaming mode doesn't work neither before nor after this.

You still need to complete the installation in desktop mode, as per recommendations

However, instead of flatout crashing, the installer returns a message: No such interface ?org.freedesktop.portal.FileChooser? I guess this could be managed by returning a message explaining the limitations of steamdeck in gaming mode and requesting the user to switch to desktop in order to complete the installation.

This is unrelated to the crash described by the people in the issue I previously linked, btw.

Jujstme avatar Mar 19 '25 19:03 Jujstme

Installation in gaming mode doesn't work neither before nor after this.

You still need to complete the installation in desktop mode, as per recommendations

I'm aware, but I remember NFD portal not even working even when booting into Desktop mode first. We need to verify that.

DarioSamo avatar Mar 19 '25 19:03 DarioSamo

It works on my steam deck, but people are welcome to test, obviously.

Jujstme avatar Mar 19 '25 19:03 Jujstme

Alright, guess I'll have to re-check then.

Are there any possible downgrades concerning these?

  • The ability to access mounted drives (I have a vague recollection it didn't quite show me all the options I had available on GTK).
  • The ability to select multiple files.
  • The ability to select multiple folders.
  • Text size on the Deck.

DarioSamo avatar Mar 19 '25 20:03 DarioSamo

* The ability to access mounted drives (I have a vague recollection it didn't quite show me all the options I had available on GTK).
* The ability to select multiple files.
* The ability to select multiple folders.

All of those seem to work fine on my end.

* Text size on the Deck.

I'll post a screenshot taken from my deck: Screenshot_20250319_200042

Jujstme avatar Mar 19 '25 22:03 Jujstme

Thanks, I guess we should get someone in a different DE (e.g. Gnome) to check if it's not too much trouble. I'm using KDE too so I probably won't see much of a difference.

I think as an addendum to this PR, we should probably take the chance to display a friendlier error message considering this won't crash unlike what GTK is currently doing if desktop mode isn't run first.

We could probably display a message like this instead:

Failed to open a file dialog. Make sure a desktop environment is available.\n\nError: %s

%s being the error message from NFD.

We'll need to localize this so we need to finalize this string first before calling the rest for localization, so feel free to suggest a variation.

DarioSamo avatar Mar 19 '25 22:03 DarioSamo