<html><head></head><body><div>You just select PropertyNotify. It tells you which property has updated in the event (for example xprop -root -spy _NET_ACTIVE_WINDOW). <br><br></div>
<div>One small note: check the actual value of the property since a window manager may set it to None if no window has focus. <br><br><br></div>
<div>Regards <br>Ingo <br><br></div>
<div class="gmail_quote" >On Oct 15, 2016, at 20:16, Jack Bates <<a href="mailto:m7iwhf@nottheoilrig.com" target="_blank">m7iwhf@nottheoilrig.com</a>> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="blue">Thanks! Is there an event for _NET_ACTIVE_WINDOW, or should I continue <br>to wait for FocusIn but then read _NET_ACTIVE_WINDOW?<br><br>On 15/10/16 09:46 AM, Ingo Bürk wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> You're selecting FocusIn on the root window, but you won't really ever<br> see it being triggered there. You'd need to select it on each top-level<br> window and also keep track of new windows being mapped etc.<br><br> If you have an at least somewhat EWMH compliant window manager I'd<br> suggest you just watch _NET_ACTIVE_WINDOW on the root window instead.<br><br> On 10/15/2016 05:25 PM, Jack Bates wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> How do I get the *new* active window after a FocusInEvent?<br> The following is my attempt, but I get the *old* active window instead.<br> My
goal is
to automatically move the mouse to the new active window<br> when I change active windows, say by pressing Alt-Tab or closing the<br> old active window.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> #!/usr/bin/env python3<br><br> import xcffib<br> from xcffib.xproto import CW<br> from xcffib.xproto import EventMask<br> from xcffib.xproto import FocusInEvent<br><br> conn = xcffib.connect()<br><br> setup = conn.get_setup()<br> for screen in setup.roots:<br> conn.core.ChangeWindowAttributes(<br> screen.root,<br> CW.EventMask,<br> [<br> EventMask.FocusChange,<br> ],<br> )<br><br> conn.flush()<br><br> while True:<br> event = conn.wait_for_event()<br> if isinstance(event, FocusInEvent):<br> reply = conn.core.GetInputFocus().reply()<br> conn.core.WarpPointer(<br> xcffib.XCB_NONE,<br> reply.focus,<br> xcffib.XCB_NONE,<br> xcffib.XCB_NONE,<br>
xcffib.XCB_NONE,<br> xcffib.XCB_NONE,<br> 0,<br> 0,<br> )<br><br> conn.flush()<br></blockquote></blockquote></blockquote><hr><br>Xcb mailing list<br>Xcb@lists.freedesktop.org<br><a href="https://lists.freedesktop.org/mailman/listinfo/xcb">https://lists.freedesktop.org/mailman/listinfo/xcb</a></pre></blockquote></div></body></html>