emacs-devel
[Top][All Lists]
Advanced

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

Re: HowTo: Detect Laptop waking up from suspend from Emacs


From: Michael Albinus
Subject: Re: HowTo: Detect Laptop waking up from suspend from Emacs
Date: Sat, 11 Feb 2017 10:10:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

address@hidden writes:

Hi,

> Background:
>
> I run Emacs as my primary environment -- ie I do everything in Emacs
> on Linux.
>
> So when I open my laptop lid, my laptop wakes up from suspend and
> Emacs is where I left off.
>
> I'd like to set things up so emacs runs a set of actions when the
> laptop comes back from suspend -- typically, say 5 seconds after
> wake-up. Here, all actions are emacs functions.
>
> So Q:
>
> From Emacs --- perhaps an idle-timer, how do I detect when the laptop
> returns from suspend?

The D-Bus system bus offers the org.freedesktop.UPower.Wakeups interface
(provided, your GNU/Linux system runs the upowerd daemon). Maybe you
could register for the DataChanged signal. I've never tried it myself,
'tho.

Another possibility could be the D-Bus system bus org.freedesktop.login1
interface. Signal PrepareForSleep seems to be emitted in both cases, the
system goes to sleep (argument true), or the system wakes up from sleep
(argument false). You could register for this signal. Again, I've never
tried it myself.

Best regards, Michael.



reply via email to

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