Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
29
rated 0 times [  29] [ 0]  / answers: 1 / hits: 24766  / 2 Years ago, wed, august 17, 2022, 5:43:32

I'd like to have a desktop notification whenever a command that has run for more than, say 15 seconds, finishes in an interactive shell.



In other words, I would like all commands to be wrapped in something like this



start=$(date +%s);
ORIGINAL_COMMAND;
[ $(($(date +%s) - start)) -le 15 ] || notify-send "Long running command finished"


What's the best way to accomplish this in bash?


More From » bash

 Answers
6

You want https://launchpad.net/undistract-me (installable from the Ubuntu archives with sudo apt-get install undistract-me) which does precisely what you're asking for, including working automatically (that is, without having to remember to add something extra to potentially long-running commands).


[#27328] Thursday, August 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
egantfis

Total Points: 406
Total Questions: 108
Total Answers: 108

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
;