This question already has an answer here:
- What process created this X11 window? 5 answers
I decided to get the completely unused pause key on my keyboard to actually pause things so I wrote a
pause <pid> shell function to toggle the state a process and assigned
pause $(xdotool getwindowfocus getwindowpid) to the key with sxhkd.
The problem is that xdotool and other utilities I have tried rely on the
_NET_WM_PID property which is really unrealiable in my setup: I use firejail for the majority of programs and in that case it seems to always return the PID "3" while for games and other binaries running in a chroot environment the property it's not even set.
Is there any other method to associate a PID to a window? The X.org server must have this information, or does it?