0

I'm running Raspbian Pi2 v11 (bullseye), in the GUI, and I have two full-screen applications running (one of them is a web browser). But I need to switch the visible application via code; I'm looking for ideas on how to do this. Thanks.

Note: The second application is custom software, so I could have it initiate some kind of "bring to front" or "send to back" if this can't be done via command-line.

0

2 Answers 2

1

I have just written code in python to do that in a different context. I used xprop (part of x11-utils) to interrogate the properties of the focussable windows and find the relevant window id and then I used xdotool to activate the required window by its id. The code is at the end of the file popup.py in the attached post. The xprop code is in the function get_window_info and the xdotool code is in the function focus_window. I hope the code is self explanatory but come back if you have any questions about how it works.

Raspberry Pi OS: Alt+Tab switches only between most recently focused windows

0
0

Drdrm46 had the answer. Here it is for those who show up later:

first, install xdotool...

sudo apt-get install xdotool

find the list of stacked window ids...

xprop -root | grep "_NET_CLIENT_LIST_STACKING(WINDOW)"

identify its name if necessary...

xprop -id 0x1400003 WM_NAME

activate the desired window...

xdotool windowactivate 0x1400003

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.