Here is a little Emacs Lisp snippet that I've started using. It makes Emacs pop up a desktop-wide notification when a compilation finishes, i.e. after " M-x compile " is done. Let's see if that keeps me from wasting time in the web when I launch a compilation.

( setq compilation-finish-functions ( append compilation-finish-functions ' ( fmq-compilation-finish ))) ( defun fmq-compilation-finish ( buffer status ) ( call-process "notify-send" nil nil nil "-t" "0" "-i" "emacs" "Compilation finished in Emacs" status ))