How bad of an idea is it to mask/unmask sleep for sunshine/moonlight

I use sunshine/moonlight a lot. I have not found an acceptable way to block sleep when doing so. I can’t use systemd-inhibit because sunshine is already running. I can’t just have a script run to block, because then what do I use to stop it (sunshine has settings for starting a command then then undoing a command). kde-inhibit is pretty much just systemd-inhibit as well, since it requires a command to block on.

I could theoretically create a systemctl service that runs a script that itself does nothing but block using dbus, but it seems a bit of a roundabout way to do it. So how bad of an idea is it to just use systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target? and then to undo it use systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target.?

I’m no pro at linux desktop, so if there are other problems with this solution, I’m all ears.

Also, I have no clue what to tag this lol.

Ok, I figured it out.

Do command: /usr/local/bin/sunshine-inhibit-start.sh

#!/bin/sh
exec systemd-inhibit --what=sleep:idle --who="Sunshine" --why="Remote session active" --mode=block sleep infinity &

Undo command: /usr/local/bin/sunshine-inhibit-end.sh

#!/bin/sh
pkill -f "systemd-inhibit.*sleep infinity"

image

woo!