Hey, I work on gnome-terminal. I am trying to add support for notifying the user when a long-running command finishes in an inactive tab or window. I am currently emitting a custom escape sequence [1] from PROMPT_COMMAND, with the command parsed from $(history 1) as an argument.
However, we are seeing some problems. If you are using job control, then the last command in the history is not the actual command that you were running. The other is that we get a spurious emission on shell start-up. Usually it is a not a problem because it is the active tab, so we filter it out anyway. However if you spawn a few tabs very fast, then it can happen that the tab was already inactive by the time the prompt showed up. We work around this in the terminal. I don't want to make gnome-terminal use trap ... DEBUG to record the commands either because that would be hijacking something that the user would want to use. What do you think? Having bash offer a way to reliably find the last foreground command interactively run by the user would be helpful. Cheers, Debarshi [1] OSC 777 which urxvt and terminology also use for plugins and extensions