I'd like to be able to set an inactivity timer for a terminal window (OSX) - so if I hadn't typed anything for n minutes it would give a 'beep/alert/run script' - is there a as-yet-unfound-by-me-terminal command/command-line-fu that does this?
Running a delayed command is simple:
Wrapping that in start/stop timer functions:
You can add that your shell rc file. Now you need to run
I am guessing you use bash? In that case there is PROMPT_COMMAND to run a command before every prompt. But nothing built-in to run before every command execution. There is a known trick to get that here. So add this also to your .bashrc:
If you use zsh on the other hand its simpler:
I thought this was an interesting thing to figure out. I don't have BSD, so I solved
the problem on Linux. There is something like inotify for BSD, called
kqueue(2), but I don't know if there are convenient monitor tools like
The idea is to monitor the standard output of a terminal which is a file.