help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to determine (from Elisp) whether the Emacs frame has focus?


From: Marcin Borkowski
Subject: Re: How to determine (from Elisp) whether the Emacs frame has focus?
Date: Sat, 14 Nov 2015 09:44:25 +0100
User-agent: mu4e 0.9.15; emacs 25.0.50.1

On 2015-11-14, at 08:30, tomas@tuxteam.de wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri, Nov 13, 2015 at 08:05:11PM -0800, John Mastro wrote:
>> Marcin Borkowski <mbork@mbork.pl> 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".
>
> To be more specific, the function selected-frame (Info menu Frames / submenu
> Input Focus) gives you the selected frame.

That I know, I did my homework.  Still, evaluating

(progn (sit-for 3) (selected-frame))

and immediately going to, say, Evince, does not make Emacs say "nil", as
I (somehow) expected.

> Thanks, Jon for prompting me to read manuals and learn something :)

That's usually good;-).

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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