The semantics on macOS are still a bit murky to me and the API is woefully under documented. The steps on macOS, I think, will be what we discussed earlier where the block is put in place during sleep-request handling. I will see if it is possible to follow the same method as gnome but it may have to be through experimentation (that'll be super fun).
The other thing I was able to find in documentation from last decade is that there are two kinds of sleep, kind of as you'd expect:
- Forced sleep where the user explicitly does something like closing a laptop lid or pressing a sleep button. This kind of sleep can be briefly delayed but not blocked by an application.
- Inactive sleep where the system sleeps on user idleness. This kind of sleep can be both delayed and blocked.
Let's keep the potential semantics and processing differences in mind when designing how to make this work across platforms. It may be possible to have one system implementation emulate another but that could be cumbersome vs. a more accommodative structure.