Let's say I run:
import subprocess;
P = subprocess.Popen(['gnome-terminal');
I then get an object P
of the class Popen
:
<subprocess.Popen object at 0xb72a9d0c>
How can I then retrieve the window identity
of this subprocess?
Ultimately, I would like to manipulate the geometrical properties of the window spawned by the subprocess using wmctrl, but for this I need something known as the windows identity
of the window (see the documentation of wmctrl)
To provide more context to the question, wmctrl -l
outputs a list of windows running on the GNOME desktop, where the first column shows the window identity
of each window. This is a hexadecimal number that I have noticed is different from the one included in the output reported by Popen above.
I checked the Popen documentation but I am not sure how to proceed from this point.
Any thoughts? Thanks!
An easy way to get the window ID is to use wmctrl -lp
which will include the PID of the processes. Find the one that matches the Popen.pid
of your subprocess and you'll find the window id of the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With