@sindresorhus looks like there is an xdg portal available for this, not sure how many desktop environments make use of this, but al least GNOME.

github.com/flatpak/xdg-desktop