There is a new xdg-desktop-portal API to support trashing files:
Essentially the confined app passes in a file descriptor (proving access to the file), and the xdg-desktop-portal service moves it to the user’s trash folder. The desktop interface should already allow access to this D-Bus API.
If the application is using the libgio GFile API to trash files, and the container has a sufficiently new glib, then turning on portal support with GTK_USE_PORTAL=1 should be sufficient. Unfortunately, “new enough” in this case means >= 2.59.2, which is newer than you’ll get by default building a core or core18 snap.
The sandbox-side portal support code is spread between a number of libraries, including glib and GTK. In this particular case the support code is in a library shipped in the core18 base snap, but that’s not always the case.
The current plan is to try getting required portal support changes into bionic-updates. That has the dual benefit of the changes finding their way into the core18 base snap, and Snapcraft defaulting to use those packages for when building new snaps.
For small changes, this is probably the easiest method of getting the changes out there. Given that these changes provide no benefit outside the sandbox though, I do worry we might see pushback if the changes are more invasive. I’m not sure what we’d do if that happens. For Ubuntu Phone we had an overlay PPA that replaced distro packages, but that obviously has its own trade offs.