summaryrefslogtreecommitdiffstats
path: root/irssi_notify.sh
blob: de3d387603ea56e53203ff8f3f105fee8dc325f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

[[ -z $DISPLAY ]] && exit 1;

exec 0<&-

ssh mistral 'tail -f -n0 ~/.irssi/fnotify' |
	sed -ru "
		s/&/\&amp;/g;
		s/</\&lt;/g;
		s/>/\&gt;/g;
		s%(#[a-zA-Z]+ )&lt;([^>]{0,10})&gt;%\1<b>\2</b> %g
		s%(https?://[^ ]+\.[a-zA-Z]{1,3})%<a href=\"\1\">\1</a>%g;
		s%([a-zA-Z0-9+_-]+@[^ ]+\.[a-zA-Z]{1,3})%<a href=\"mailto:\1\">\1</a>%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