wmctrl -l gives me the following
0x00600003 0 arundeep-desktop takeScreenshot.py - GunzBossImageDetection - Visual Studio Code
0x0300001d 0 arundeep-desktop Obtain Active window using Python - Stack Overflow - Google Chrome
0x04400003 -1 arundeep-desktop @!0,0;BDHF
0x04a00003 0 arundeep-desktop Freestyle GunZ
I want the 0x04a00003 where the applications I'm checking have the Freestyle GunZ title name. Afterwards I want to switch to it. Hard coded it works but I don't know how to pull from the results.
import subprocess
import os
import time
PROCNAME = "Freestyle GunZ"
try:
results = subprocess.check_output("wmctrl -l ",shell=True,stderr=subprocess.STDOUT)
print(results)
os.system("wmctrl -iR 0x04a00003")
time.sleep(1)
os.system("xwd -id 0x04a00003 | convert xwd:- image.png")
except subprocess.CalledProcessError as e:
raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))