How to know which window has focus and how to change it?

前端 未结 4 1841
太阳男子
太阳男子 2020-12-05 15:17

I would like to know how can I ask X11 which windows has focus. And if for any reason my own application (that may be visible or not) got the focus I want be able to let the

4条回答
  •  伪装坚强ぢ
    2020-12-05 16:16

    Take a look at the _NET_ACTIVE_WINDOW value of the root window which is set by most modern window managers:

    xprop -root _NET_ACTIVE_WINDOW
    

    This value can, of course, be obtained using Xlib library calls.

提交回复
热议问题