From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: HowTo: Detect Laptop waking up from suspend from Emacs Date: Sat, 11 Feb 2017 10:10:32 +0100 Message-ID: <87a89thz3r.fsf@gmx.de> References: <22686.27448.427789.633250@gargle.gargle.HOWL> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486804277 16105 195.159.176.226 (11 Feb 2017 09:11:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Feb 2017 09:11:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: raman@google.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 11 10:11:13 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccTi4-0003qT-V0 for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 10:11:13 +0100 Original-Received: from localhost ([::1]:47598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccTiA-0006pu-LV for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 04:11:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccThb-0006pp-PN for emacs-devel@gnu.org; Sat, 11 Feb 2017 04:10:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccThW-00078h-Ej for emacs-devel@gnu.org; Sat, 11 Feb 2017 04:10:43 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:63760) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccThV-00078T-VL for emacs-devel@gnu.org; Sat, 11 Feb 2017 04:10:38 -0500 Original-Received: from detlef.gmx.de ([93.197.203.52]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MUHoI-1d2IKB4Bt4-00Qxne; Sat, 11 Feb 2017 10:10:34 +0100 In-Reply-To: <22686.27448.427789.633250@gargle.gargle.HOWL> (raman's message of "Fri, 10 Feb 2017 17:39:04 -0800") X-Provags-ID: V03:K0:6l8xarQTl3UwbjjByZhZFRuF2ZlwvDUjBIkLnd3lI57UsoNCRYr jyA16BYUhcPIU/IOR4YY4oDoWCTbXZRvPsxybOPiOCs68ZRAqfanHrGx/kiI318eJHevVwv tISCkegde2YLTxRPk5kZg/Rkb1g3/5eYBQCyUYZnPfZD8rGWvwPkqR+KjSg4A8J1hSh2ccz nwfRRUTYbW4hrrD67VXdQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:QbU4HqJE1vM=:P9QXPlAqH4GWiJbYNR+cN7 epI4GOqyQ01xmgydNEWm1eGSqrE+A549X1yvZYKzDQLjieJtOPTnB4n2M4Iuzvo47gzk7DOgw vL7uy2T0mP+uoPK18R6hFcMRId5yNJBXyf6EWsNefRZHfaInT8LDh5bQ/9HtEzS33UL87rd4k 6UalBD6GmyUz8g/1KeFvwLNcBNXSH3/0uxTGDzAcKyW+zEOtAjk9TXSy2fCrg/PJUHneIHmis i6C5QPJ8NMS8+IvEW816e1+k2T0ao8MqLeIqe5CaGf/+9Q8aPUSoEyQl+UkpnT3CwBmGUxWbD co1bXFz2BpoX5WREBXF2LXAPaTjub/jfo5gzmhmSzryjaH/vTUY4ORuxvRDP67C4Xu5DOaec7 lZ/9JJQcs75Td/sSYnQxZQ9Bd9fxmM5G60UtzNzCn6Q45vfNwaEf1uPZJuMMlAHSa7i8LGU8O 614d561whKSZkxNvHnmr7YUOxz8IK2zp7IUcHeyInKLBJEblMhNFJ74sDLXMDKD1ljeLcvl25 kEfWBXzLS776CcsBsFjwx9ragEnighyBJGq650QGAzWDpn/X+ZXwh3FbDC4Po8o6dG7gZ/KBr C30tYZPnOHk17iWb60sw2cjDHwPngBgUTJTl9CgQ4dPwRR9Wg48Gx8YiQ4aclWf32rdpkxBYN Sjl/xR9+HwuGojbnK6CjAgS8NeHBGTw/DAxlecjh6B/RcZP0fWH8WZepdUo5u1/VTwV1WlJVt z7cS3HVA/wi4P84vA1uUIsgWi45tOQw3jaJNrk+DjV0YoQ+9NkrAaBKhlh0rx3X2mpu9XVyg X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212223 Archived-At: raman@google.com 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.