Skip to content

Cannot raise window on top using configure() or raise_window() #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
invader-zimm opened this issue Dec 21, 2024 · 0 comments
Open

Cannot raise window on top using configure() or raise_window() #280

invader-zimm opened this issue Dec 21, 2024 · 0 comments

Comments

@invader-zimm
Copy link

I'm trying to bring a specific window on top of all else and set focus to it. This is what I have so far:

def focus_window(window_id):
    d = display.Display()
    window = d.create_resource_object('window', window_id)
    window.map()
    window.configure(x=10, y=30, width=800, height=600, stack_mode=X.Above)
    window.set_input_focus(X.RevertToParent, X.CurrentTime)
    d.sync()

if __name__ == "__main__":
    focus_window(0x034000fc)

With the code above, everything works except the window being drawn on top. The focus is put into the window of interest, said window is moved and resized as expected but it doesn't raise on top. If I use window.raise_window() nothing happens. Using either methods, I don't get any error messages, it just doesn't work.

Am I missing something, or doing something wrong? I'm using MATE Desktop (on X, of course), Python 3.12.7 on Fedora.

Also, is there a way to get the window ID from the process PID using python-xlib? At the moment I'm using wmctrl but I'm wondering if there's a better way.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant