chiark / gitweb /
first cut at irssi desktop notifications
[bin.git] / irssi-notify-server
diff --git a/irssi-notify-server b/irssi-notify-server
new file mode 100755 (executable)
index 0000000..27eba2f
--- /dev/null
@@ -0,0 +1,25 @@
+#! /bin/sh
+set -e
+
+# Based on:
+#   http://thorstenl.blogspot.com/2007/01/thls-irssi-notification-script.html
+
+FNOTIFY="$HOME/.irssi/fnotify"
+TAIL=
+
+cleanup () {
+       rm -f "$FNOTIFY"
+       if [ "$TAIL" ]; then
+               kill "$TAIL"
+       fi
+}
+trap cleanup EXIT HUP INT QUIT PIPE TERM
+
+tail -n 10 "$FNOTIFY" 2>/dev/null || true
+> "$FNOTIFY"
+tail -f "$FNOTIFY" &
+TAIL="$!"
+while :; do
+       echo .
+       sleep 5
+done