+installed() {
+ type "$1" >/dev/null 2>&1
+}
+# $1: timeout
+notify() {
+ if installed dzen2; then
+ sed 's/\^/^^/g' | dzen2 -fg blue -bg yellow -y 15 -h 30 -p "$1"
+ elif installed xmessage; then
+ # Fallback solution, display first line of stdin.
+ read x
+ xmessage -timeout "$1" "$x" &
+ fi
+}