Replace grep|sed call with a pure sed call and copy XAUTHORITY, too (suggested by Paul Wise <pabs@debian.org>).
Activate notification by mail as default.