I am trying to find an unmapped window on my X server in order to map it back and send it some EWMH hint. Because the window is unmapped I cannot use EWMH to ask the window manager directly. So I am trying to get it through Xlib, but I am experiencing problems with it. The whole API is very confusing for me.
I am using Python's Xlib wrapper. Now lets have a look at following Python script:
import subprocess from time import sleep from ewmh import EWMH subprocess.Popen(['urxvt']) # Run some program, here it is URXVT terminal. sleep(1) # Wait until the term is ready, 1 second is really enought time. ewmh = EWMH() # Python has a lib for EWMH, I use it for simplicity here. # Get all windows? windows = ewmh.display.screen().root.query_tree().children # Print WM_CLASS properties of all windows. for w in windows: print(w.get_wm_class())
What is output of the script? One opened URXVT terminal and something like this:
None None None None ('xscreensaver', 'XScreenSaver') ('firefox', 'Firefox') ('Toplevel', 'Firefox') None ('Popup', 'Firefox') None ('Popup', 'Firefox') ('VIM', 'Vim_xterm')
But when I run this command and click on the opened terminal:
$ xprop | grep WM_CLASS WM_CLASS(STRING) = "urxvt", "URxvt"
The same is with WM_NAME property.
So finally a questions: Why there is no "URxvt" string in the output of the script?