From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: How to determine (from Elisp) whether the Emacs frame has focus? Date: Fri, 13 Nov 2015 20:05:11 -0800 Message-ID: References: <87fv09o9p5.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1447473963 3504 80.91.229.3 (14 Nov 2015 04:06:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Nov 2015 04:06:03 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 14 05:05:51 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZxS5y-0005Ak-TZ for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Nov 2015 05:05:47 +0100 Original-Received: from localhost ([::1]:57834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxS5z-0000Oz-2L for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Nov 2015 23:05:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxS5k-0000OL-DF for help-gnu-emacs@gnu.org; Fri, 13 Nov 2015 23:05:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxS5j-0000Ri-8K for help-gnu-emacs@gnu.org; Fri, 13 Nov 2015 23:05:32 -0500 Original-Received: from mail-yk0-x22e.google.com ([2607:f8b0:4002:c07::22e]:33533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxS5j-0000RT-51 for help-gnu-emacs@gnu.org; Fri, 13 Nov 2015 23:05:31 -0500 Original-Received: by ykdv3 with SMTP id v3so177981485ykd.0 for ; Fri, 13 Nov 2015 20:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=HiU4wvVPDofDarAmbK//2chwNagtPzmr/eM/zQtomFI=; b=B3wOFSkYPN7JlCHHkq8Mkx/v1R59V3NAoQd1ByIcljJISaE2+jqacJFGu0/NsmU0yr TD/HRewOS27IRm5zHJDH89TiWAkOCp3DJbdJD7a1uOEpuZGBGgm4XrYSkLHIWZXxie2Q 1S0jROIsxldzNjphmxEweofwW0ouRPG2/YccCWkLQU+s9Ni9oQ8LRNVmtXZssvYVjx+k Cvp8ccASd083KKM0saK55Eh2E2KauxDlc3RiuAtl+/NEHYVkLkHg35YBLvBCs7PDaw3q 4b/ESA9jvvTaMOx6wOQRDF32jhAHDJJYHmnf/LdwpcpcMTAf7XTEPHI5BLR/ps9AbMJH X+Vg== X-Received: by 10.129.13.215 with SMTP id 206mr27660210ywn.280.1447473930647; Fri, 13 Nov 2015 20:05:30 -0800 (PST) Original-Received: by 10.37.75.70 with HTTP; Fri, 13 Nov 2015 20:05:11 -0800 (PST) In-Reply-To: <87fv09o9p5.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::22e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108051 Archived-At: Marcin Borkowski wrote: > I'd like to know whether the selected Emacs frame has focus. Currently, > I'm using an xdotool/xprop combo (I'm on GNU/Linux), but I'd like to > know whether there is a better way. I know about focus-in-hook and > focus-out-hook, and I could make them set/unset some global variable, > but this looks hackish. Not that I can tell. I'm not sure if it would end up less hackish, but an alternative to global variables might be to use frame parameters. See the info nodes "(Elisp) Frame Parameters" and "(Elisp) Parameter Access". -- john