#!/bin/bash
[[ -z $DISPLAY ]] && exit 1;
exec 0<&-
ssh mistral 'tail -f -n0 ~/.irssi/fnotify' |
sed -ru "
s/&/\&/g;
s/\</g;
s/>/\>/g;
s%(#[a-zA-Z]+ )<([^>]{0,10})>%\1\2 %g
s%(https?://[^ ]+\.[a-zA-Z]{1,3})%\1%g;
s%([a-zA-Z0-9+_-]+@[^ ]+\.[a-zA-Z]{1,3})%\1%g;" |
while read heading message; do
if [[ -n $heading ]]; then
ssh mistral 'echo "" > ~/.irssi/fnotify';
ossplay ~/misc/High_Bee-Public_D-135.wav
notify-send -t 5000 -- "${heading}" "${message}";
fi
done