I hacked together a Python + GTK project to inhibit/uninhibit sleep via a simple GUI.
This was put together in 3 hours and I am very proud of this janky code.
My blog goes into the background for this as well as its implementation.
Give it a read:
https://blog.suryatejak.in/sleep-stopper-a-simple-gtk4-app-to-stop-linux-from-sleeping