import Xlib
import Xlib.display
def get_window_by_id(winid):
mydisplay = Xlib.display.Display()
root = mydisplay.screen().root # should loop over all screens
inspection_list = [root]
while len(inspection_list) != 0:
awin = inspection_list.pop(0)
if awin.id == winid:
return awin
children = awin.query_tree().children
if children != None:
inspection_list += children
return None
# use xwininfo -tree to click on something (panel was good for me)
# until you find a window with a name, then put that id in here
print get_window_by_id(0x1400003)
print get_window_by_id(0x1400003).get_wm_name()