I want to know which desktop a given process is running in. I can get this from the window ID using
wmctrl. I can also find out which terminal emulator process a given process is running in by tracing the parental lineage up to a terminal process.
However, a given terminal process will have multiple windows spread across multiple desktops.
I use the terminal emulator
roxterm these days, although both Konsole and gnome-terminal are similar to it in this respect.
Is there a way to query one or more of these apps to find out which of their windows a given process is running in? If it requires
gdb hackery, well, hack away. Though something likely to continue to work after an update would probably be better :)
I'm not entirely opposed to tracking this stuff at bash initialization, but I'm loathe to sort out all the gory details, and it seems likely that there are some significant edge cases that won't work with such an approach. Though maybe somebody has already figured this out?
Alternatively, if there is another terminal emulator that provides a richer interface for accessing such introspective data, that would be good to know.
I could get around this by running each window in a separate process, but the compromises both in terms of memory usage and versatility (eg moving a tab from one window to another) are probably unacceptable. Mostly it's the memory usage.