I'm aware it's already been asked how to make a sound after a command.
Despite people seem to intend to use it after long-running commands, there is initially no connexion between the actual trick and the duration of the command.
My question here is, can I (using bash or zsh) make my terminal execute a script that would wrap every command looking at start time and comparing when it finishes to end time and if and only if the command lasted more than X minutes, the sound is played?
Because in practice, those long running commands are often new and there is no chance I anticipate this every time!
Bonus: the sound should not be played for interactive commands (eg. ssh xxx), if it is too hard, the criteria could be whether the focus is given to the window or not.
Thanks a lot!