我尝试使用:
win.configure(stack_mode=X.TopIf) win.set_input_focus(X.RevertToParent, X.CurrentTime)但是,即使在我的窗口管理器上没有任何防止焦点丢失的方法,这也不起作用,有人知道有另一种方法可以做到这一点吗?是否使用Xlib.
However even without any focus loss prevention on my window manager this does not work, does anyone know of another way to do this? Xlib or not.
推荐答案有一个名为 wmctrl ,使您可以与EWMH/NetWM兼容的X窗口管理器进行交互.
There is a command-line tool called wmctrl which allows you to interact with EWMH/NetWM-compatible X window managers.
例如,
wmctrl -l列出由窗口管理器管理的所有窗口,并且
lists all the windows managed by the window manager, and
wmctrl -a Mozilla使列表中的第一个窗口处于活动状态,该窗口的标题为字符串"Mozilla". 还有其他选择窗口的方法.以上只是一个例子.
makes active the first window in the list which has the string "Mozilla" in its title. There are other ways to select windows; the above is just an example.
wmctrl也使您能够移动和调整窗口大小.
wmctrl enables you to move and resize windows too.
更多推荐
Python:Xlib
发布评论