With the addition of flatpak portals, flatpak apps can open up any uri in an appropriate external app. This means they could support xdg-open and xdg-email.
We detect the flatpak sandbox in xdg-open and xdg-email and call into the flatpak portal over dbus when appropriate. Then we can add xdg-utils to flatpak runtimes, and make life easier to apps relying on the tool.
Created attachment 128154 [details] [review]
xdg-open: add flatpak support
Created attachment 128155 [details] [review]
xdg-email: add flatpak support
Patches attached. Didn't bother adding a fallback if gdbus is not detected cause I think it should be fine to just error noisily in that case.
A commit showing how to build into a flatpak app is here, though hopefully this can go into the freedesktop runtime.