Find out in Linux which application / frame is in focus?
Modern window managers set a property _NET_ACTIVE_WINDOW
on the root window. See Question How do I know which window has focus and how can I change it?
source to share
Yes
At a low level, this information can be retrieved from the X server using xlib calls. At a higher level, window administrators sometimes implement accessibility protocols that must bind focus, and in any case, their respective tools will have higher level abstractions.
Examples of accessibility functions are atk and at-spi. Libraries that provide windowing functions are good examples: see XEmbed. Check out Qt and Gnome documentation for focus related C ++ API elements.
source to share
A quick tour of Google suggests XGetInputFocus
. There's a good example program linked here
source to share