On macOS, the receiver of a "will sleep" notification can delay sleep for some time. There's also a message when the screen is put to sleep but not the OS that might have some utility. On Thu, Feb 6, 2025 at 12:20 AM Stefan Monnier wrote: > > The idea is that you add code to detect the change at the OS level, > > and then create an event of type sleep-event with an argument of t for > > sleep and nil for wake. The lisp package detects the sleep-event and > > runs the appropriate code. > > BTW: I understand what a "wake" event means, but what about > a "sleep" event? I mean: how can we receive this event before we wake > up again? Or does it mean that we're about to sleep? If so what do we > know about when we'll sleep? Can we influence (e.g. delay) it? > > > Stefan > >