Detecting if a window exists from AppVM

Since wmctrl doesn’t work in AppVMs, how is it possible to find out if a window for a given app exists, from within that AppVM’s script?

You can get them in dom0 (or GUIVM). By using wmctrl -l and xprop -id WindowID | grep _QUBES_VMNAME