bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake


From: Andrew Cohen
Subject: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake
Date: Mon, 05 Jun 2023 21:06:37 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Dear Michael

>>>>> "MA" == Michael Albinus <michael.albinus@gmx.de> writes:

[...]

    MA> Using D-Bus is just an implementation detail. What you want are
    MA> handlers, which are invoked when your laptop falls asleep or
    MA> awakes.

Yes, of course you are right!

    MA> A general package could implement it using D-Bus if available,
    MA> or using something else if there's no D-Bus. See battery.el,
    MA> which uses the D-Bus service "org.freedesktop.UPower" only if
    MA> possible. Your package might be called sleep.el or alike.

I am not familiar with other methods for detecting sleep/wake, so I just
have dbus at the moment. But if anyone knows of something else
(especially on windows) it can then be added.

[...]

MA> I would make it rather a global minor mode, that you can
MA> enable/disable it easily.

Yes, that is a better idea. 

[...]

    MA> Perhaps, you check also for the service
    MA> "org.freedesktop.login1", like

    MA> (member "org.freedesktop.login1" (dbus-list-activatable-names
    MA> :system))

OK, added.


I've now put everything together and modified the gnus code to use the
new sleep.el. But I remain unsure if I should remove gnus-dbus.el
entirely (everything remains the same for the user: setting
gnus-dbus-close-on-sleep to a non-nil value will enable the feature
using the global minor mode rather than gnus-dbus).  And is sleep.el
something worth adding?

Attachment: sleep.el
Description: sleep.el


-- 
Andrew Cohen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]