GNU bug report logs - #63620
30.0.50; [Feature Request] run hooks on sleep/wake

Previous Next

Package: emacs;

Reported by: Andrew Cohen <acohen <at> ust.hk>

Date: Sat, 20 May 2023 23:25:02 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Full log


Message #121 received at 63620 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Andrew Cohen <acohen <at> ust.hk>
Cc: 63620 <at> debbugs.gnu.org, eliz <at> gnu.org, michael.albinus <at> gmx.de,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake
Date: Thu, 6 Feb 2025 08:07:44 -0500
[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.