I don’t think there is a good answer at the moment.
If you use classic confinement, then your snap should see the real value of
$HOME. But this has the downside of requiring the user to pass extra flags to
snap install, and requires a bit more care to make the snap distro version independent.
I have been looking into using getting xdg-desktop-portal working with snaps, and while I got a proof of concept demo working it is far from ready for deployment. Under this model, things would behave a bit differently:
- you would no longer have to connect to the
- assuming the appropriate modules are loaded, the Qt file picker API would ask a process outside of the confinement sandbox to display the dialog box, and the file the user chooses would be made available at a path your app can read/write.
Since the file picker is out of process, it doesn’t matter what
$HOME is inside the sandbox.