Python: Xlib — How can I raise(bring to top) windows?

前端 未结 3 1646
星月不相逢
星月不相逢 2021-01-13 03:42

I\'ve tried using:

   win.configure(stack_mode=X.TopIf)
   win.set_input_focus(X.RevertToParent, X.CurrentTime)

However even without any fo

相关标签:
3条回答
  • 2021-01-13 03:54

    Try this:

    window=Display().screen().root.query_pointer().child
    window.set_input_focus(X.RevertToParent, X.CurrentTime)
    window.configure(stack_mode=X.Above)
    
    0 讨论(0)
  • 2021-01-13 04:05

    Perhaps this is the solution:
    [Xlib] Force Raise/Map/Focus a given Window

    A solution given (follow the thread) involves using wnck, which in Python is a part of the Gtk+ bindings.

    0 讨论(0)
  • There is a command-line tool called wmctrl which allows you to interact with EWMH/NetWM-compatible X window managers.

    For example,

    wmctrl -l
    

    lists all the windows managed by the window manager, and

    wmctrl -a 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 enables you to move and resize windows too.

    0 讨论(0)
提交回复
热议问题