unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to determine (from Elisp) whether the Emacs frame has focus?
Date: Sat, 14 Nov 2015 08:30:41 +0100	[thread overview]
Message-ID: <20151114073041.GA22234@tuxteam.de> (raw)
In-Reply-To: <CAOj2CQSHk5pvWR-0yrU_VhPMo65hhHAs132W1LPV1LMMYkGWtg@mail.gmail.com>

-----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.

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

- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZG4yEACgkQBcgs9XrR2ka2qQCaAykYO4/O/hbbw9HdEu0vE+r1
xJEAniwH8eRjpaeuKF6clq0OLAl9oIRB
=nfvW
-----END PGP SIGNATURE-----



  reply	other threads:[~2015-11-14  7:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 21:45 How to determine (from Elisp) whether the Emacs frame has focus? Marcin Borkowski
2015-11-14  3:48 ` Emanuel Berg
2015-11-14  4:05 ` John Mastro
2015-11-14  7:30   ` tomas [this message]
2015-11-14  8:44     ` Marcin Borkowski
2015-11-14 10:45       ` tomas
2015-11-14 20:28         ` Marcin Borkowski
2015-11-14  8:06 ` Eli Zaretskii
2015-11-14  8:36   ` Random832
2015-11-14  9:36     ` Eli Zaretskii
2015-11-14 12:34       ` Marcin Borkowski
2015-11-14 13:40         ` Eli Zaretskii
2015-11-15  7:45           ` Marcin Borkowski
2015-11-15 19:45             ` Eli Zaretskii
2015-11-16 14:08             ` Nicolas Richard
2015-11-16 16:58               ` Marcin Borkowski
2015-11-14 21:10         ` Stefan Monnier
2015-11-16 17:00           ` Marcin Borkowski
2015-11-14  8:42   ` Marcin Borkowski
2015-11-14  8:59     ` Eli Zaretskii
2015-11-14 10:54       ` Yuri Khan
2015-11-14 11:04         ` Eli Zaretskii
2015-11-14  8:44   ` Michael Heerdegen
2015-11-14 10:15     ` Marcin Borkowski
     [not found] <mailman.2293.1447451126.7904.help-gnu-emacs@gnu.org>
2015-11-16  6:53 ` Dan Espen
2015-11-17  0:10   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151114073041.GA22234@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).