xdg-desktop-portal now has a portal for inhibiting session status changes. We don't need to use it if we can talk to the session manager, but if can't, try org.freedesktop.portal.Inhibit.
https://bugzilla.gnome.org/show_bug.cgi?id=768499
04cec61 Support the Inhibit portal
gtk/gtkapplication-dbus.c | 184 ++++++++++++++++++++++++++++++++++---------
gtk/gtkapplicationprivate.h | 4 +
2 files changed, 150 insertions(+), 38 deletions(-)
Upstream: git.gnome.org