From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: How to determine (from Elisp) whether the Emacs frame has focus? Date: Mon, 16 Nov 2015 01:53:11 -0500 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447708138 12374 80.91.229.3 (16 Nov 2015 21:08:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2015 21:08:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 16 22:08:53 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 1ZyR1A-0003hF-S4 for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 22:08:52 +0100 Original-Received: from localhost ([::1]:49492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyR1A-0006a3-Dz for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 16:08:52 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Injection-Info: mx02.eternal-september.org; posting-host="48ddaff5c9d3fd7512a0d6243d6519a4"; logging-data="4913"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19v8DDT2Rw0Cz7imFgMajc1MFteIVxcFhc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:ILMwsJaRX/rFNtPbStKwn0FTElI= Original-Xref: usenet.stanford.edu gnu.emacs.help:215804 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:108091 Archived-At: Marcin Borkowski writes: > Hi all, > > 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. > > Any ideas? Since there doesn't seem to be an existing Emacs global variable creating your own using those hooks isn't all that hackish. Go for it. -- Dan Espen