Another week, another tiny utility.

I was in a Zoom call last week with very poor video quality, which we figured out was because I was also running a long compile which wasn't leaving Zoom enough CPU to work with. So I paused the compile with ^Z and things improved.

Three hours after the call, I found the compile job, still suspended, in a window hidden behind something else. Oops. If only I'd been able to arrange to _automatically_ resume the job when the Zoom call terminated, instead of relying on my own memory!

I already have a tool 'after' which waits for a specified Unix process to terminate. But Zoom stays running even when not on a call, and there's no reason to suppose it puts the call in an easy-to-identify subprocess.

But it does put it in a separate _window_. So I wrote a tool 'xafter', which waits for a specified X window to close. Completely trivial – X11 makes it easy to ask for StructureNotify events on a window whether it's your own or not. Now if I suspend a job that's interfering with my meeting, I can immediately type 'xafter;fg' and select the meeting window, and then it'll restart automatically.

I have no idea if it would be easy to write analogues of this for Wayland, or Windows, or Mac.

@simontatham A thing I do is to add a `(J)` marker to my prompt if there are suspended jobs
@simontatham Which requires me to _look_ at that specific shell, but at least I'll see

@Lalufu right – in my case, when the entire terminal window was concealed behind something else, that still wouldn't have helped!

But it's true that in other situations I can carry on using a shell and forget that there's been a suspended background job in it for the last half hour.