Probably should be able to do the same with just:
systemd-inhibit --what=idle --mode=block sh -c read
https://github.com/eonpatapon/gnome-shell-extension-caffeine https://github.com/coadmunkee/gnome-shell-extension-espresso
Or via api, which everything leads to
https://people.gnome.org/~mccann/gnome-session/docs/gnome-se...
Noting other apps generally will inhibit via stuff sent through X/Wayland afaik, so this doesn't cover all methods