+installed() {
+ type "$1" >/dev/null 2>&1
+}
+# $1: timeout
+notify() {
+ if installed dzen2; then
+ read x
+ printf '%s\n' "$x" | 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" &
+ else
+ # Last way to send a "message", create a stupid window layout so I
+ # notice something is up and look at the logs.
+ hc fullscreen off
+ hc floating off
+ hc pseudotile off
+ hc split vertical 0.1
+ hc unlock # or we might not see the changes
+ fi
+}