One obvious problem with this is that the child of the terminal is your shell. We'd need to be inspecting grandchildren, which seems like it could easily fail.
One obvious problem with this is that the child of the terminal is your shell. We'd need to be inspecting grandchildren, which seems like it could easily fail.