How do I get the pid from the xid (X window identifier)? How do I get the list of xids for a given pid?
(Assuming all applications run with DISPLAY=:0
, without network transparency being in use)
I'm expecting something like:
/proc/`pidof X`/fd
This works for my purposes:
=^_^= izkata@Izein:~$ XID=0x340001c
=^_^= izkata@Izein:~$ printf "%d\n" $XID # Convert from hex to decimal
54525980
=^_^= izkata@Izein:~$ xdotool getwindowpid 54526066
20639
=^_^= izkata@Izein:~$ ps 20639
PID TTY STAT TIME COMMAND
20639 ? Ssl 116:25 /usr/lib/firefox/firefox