Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change focus in X-Windows?

Tags:

linux

x11

motif

I am working on old Motif-based application for Linux. I want to be able to programmatically change the active window of our application. I can redirect the input by using XSetInputFocus() function and the keyboard input start to go there, but XReconfigureWMWindow() and XRaiseWindow() functions just don't work.

I've read that Window Managers try to stop this behaviour, so tried to disable configure redirection, but this doesn't work either. Any ideas how to make one of my own windows on top of the window stack?

like image 630
theJonan Avatar asked Dec 06 '25 17:12

theJonan


1 Answers

There is a tiny program called wmctrl available (at least in Debian/Ubuntu it is in standard distribution) which is able to perform many operations on windows and desktops, and handles plenty of window managers. I'd suggest testing whether it works in your environment, and if so, peeking at its sources.

like image 102
Mekk Avatar answered Dec 08 '25 18:12

Mekk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!