https://bugs.winehq.org/show_bug.cgi?id=51134
Bug ID: 51134 Summary: Support redirecting GetOpenFileName and GetSaveFileName through org.freedesktop.portal.FileChooser Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: from_wine_bugzilla@ssokolow.com Distribution: ---
While not all options in the OPENFILENAME structure can be supported via the org.freedesktop.portal.FileChooser interface, providing the option to redirect an application's request for a common Open/Save dialog through the XDG chooser system would have two beneficial effects on non-OSX POSIX systems:
1. Better integration, since the application run under Wine would use the native desktop file pickers, complete with the user's Places sidebar bookmarks and any other customizations they've enacted.
2. More practical security, since Wine could then be run in a filesystem sandbox, with the portal host mounting files/directories into the sandboxed environment on demand.
I'd suggest a three-state option exposed through winecfg's Desktop Integration:
1. Opportunistically (Qt's approach to integrating support for XDG portals into QFileDialog provides precedent for making this the default. Uses the portal-based file chooser unless an application requests a combination of OPENFILENAME settings that cannot be represented by the portal API.)
2. Forced (An option for power users to set on a per-application basis to intentionally sacrifice the application's customizations in favour of better integration with the understanding that things may break.)
3. Never (An option for users who prefer consistency between their Windows applications over consistency with the rest of their desktop or have deleted the Z: mapping and configured their Wine prefix around the idea of only working with drive letters.)
These high-level preferences could also apply equally well to any other platform's native file chooser, should integration with it be implemented.
The D-Bus API in question is documented at https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.free...
While it is outside the scope of this feature request, it may also be possible to use the TrashFile() method of this API to integrate with the host desktop's Trash.