From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: raman Newsgroups: gmane.emacs.devel Subject: Re: HowTo: Detect Laptop waking up from suspend from Emacs Date: Sat, 11 Feb 2017 08:28:31 -0800 Message-ID: References: <22686.27448.427789.633250@gargle.gargle.HOWL> <87a89thz3r.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486830525 18007 195.159.176.226 (11 Feb 2017 16:28:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Feb 2017 16:28:45 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 11 17:28:41 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 1ccaXQ-0004Ti-QR for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 17:28:40 +0100 Original-Received: from localhost ([::1]:48802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccaXW-0007dl-9h for ged-emacs-devel@m.gmane.org; Sat, 11 Feb 2017 11:28:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccaXQ-0007ck-KI for emacs-devel@gnu.org; Sat, 11 Feb 2017 11:28:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccaXL-0008Tw-M3 for emacs-devel@gnu.org; Sat, 11 Feb 2017 11:28:40 -0500 Original-Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]:36292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccaXL-0008Tn-FG for emacs-devel@gnu.org; Sat, 11 Feb 2017 11:28:35 -0500 Original-Received: by mail-pg0-x236.google.com with SMTP id v184so19710631pgv.3 for ; Sat, 11 Feb 2017 08:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9MZLR4/m1UrXtofLYWkTQm4EIdDWdLh4jZgSaB+hb/o=; b=lDAXWXXOM5L5GOlw/1A2J+rYVYrbe5eE0gilsEd77etNqH7BNbT1wU4o8vKqswmKF8 ecDZaolX6UxhggBJgvJm7sZT72D+DeDh6rTkq6cliQaqGimxUftdXEPSRh8uU6Oy+ivA +j3s3CjyeB1hroVbwrzyUSQAeZuyjvbb7VuLKBet0GyA0Q+U3MKt/SdaeIVCrroAMgHI Ra+TC+fwLAQCN/K1cWNO9Rr083S4Z6iMrd9UV0uZsQZ+FsxbCFjk8Cg2fpShGTtI2PkX 2RyaSyQiITCmv8CMgBADO6lzalALs6jIw1C8mXUWBP0/S/+/s42P6l6bJonEJb+EG9Wt S4XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9MZLR4/m1UrXtofLYWkTQm4EIdDWdLh4jZgSaB+hb/o=; b=qfi1Xg+3voVo6Ovd5cZoDZxVRXDJZosWtor7F6GMMt7Gt+MFN8BiJPKgRWBmc4z/T3 G5l9EbT6LAsXCPFDm91DEoiimv5Rofxr5+iNFgk8gxjlXEfc/YtUnIOdQ7Z95gM7+2Q0 ikBF3jmz7C5NGjp6TAx2ZtuXlLDaMo9AQonr1gT3ymyh27DvOV7ClluF5R38dRflDCC9 WiLtqVN2g2YALHEK0DRh1RvE/YLG3NYmvgD3hMDw84Rh9lKkPHITVLtN6Zj2TLXE0HpC DiRcO1f21KhXvI1sTW9Zu+FA5fwDcvzwdP2RmemGxx+A5xhuiuo5XDmcQZk35SuczB3/ I+DA== X-Gm-Message-State: AMke39mSXcUv2XuSFIRB8DtZvObepE+7g+6a67fRCBlcJJBEjUJfCsX+OGl1jXfnIUUO71EF X-Received: by 10.99.36.7 with SMTP id k7mr17404938pgk.201.1486830513962; Sat, 11 Feb 2017 08:28:33 -0800 (PST) Original-Received: from raman-glaptop2 (c-73-170-121-60.hsd1.ca.comcast.net. [73.170.121.60]) by smtp.gmail.com with ESMTPSA id k78sm11887454pfb.93.2017.02.11.08.28.32 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sat, 11 Feb 2017 08:28:33 -0800 (PST) In-Reply-To: <87a89thz3r.fsf@gmx.de> (Michael Albinus's message of "Sat, 11 Feb 2017 10:10:32 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::236 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:212229 Archived-At: Michael Albinus writes: Thanks for the dbus pointers -- I was hoping that someone had already gone down this route:-)> 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. --