GNU bug report logs -
#63620
30.0.50; [Feature Request] run hooks on sleep/wake
Previous Next
Full log
Message #121 received at 63620 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I prefer using a mode, it seems more idiomatic. Shall this use
cl-defgeneric in sleep-wake-mode that each system can specialize?
On Thu, Feb 6, 2025 at 8:02 AM Andrew Cohen <acohen <at> ust.hk> wrote:
> >>>>> "SM" == Ship Mints <shipmints <at> gmail.com> writes:
>
> SM> The API on macOS would expose a pair of C functions to lisp, one
> SM> would inhibit sleep, perhaps returning an opaque "cookie", the
> SM> second to revoke the inhibition. The same API can be used to
> SM> prevent macOS from ever sleeping, if the user wanted that.
>
> Great!
>
> So the idea now is:
>
> Turning on sleep-wake-mode:
>
> 0. If on a system with D-Bus and logind, we register a signal for
> PrepareForSleep with a handler that generates a synthetic sleep-event on
> state change using Michael's recent insert-special-event.
>
> 1. Install 'sleep-event-handler on the special-event-map for
> [sleep-event].
>
> 'sleep-event-handler will inhibit sleep (with whatever method is
> appropriate for the system); run the function sleep-handler-function
> which is a defcustom defaulting to running the hooks; release the
> inhibition.
>
> 2. disabling sleep-wake-mode removes 'sleep-event-handler from the
> keymap and replaces it with 'ignore.
>
> (alternatively we could ask each system to expose a lisp function or
> variable to turn on and off the generation of sleep-events)
>
> Best,
> Andy
>
>
> --
> Andrew Cohen
>
[Message part 2 (text/html, inline)]
This bug report was last modified 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.