I'm in a similar situation except I use mcabber instead of irssi. Since you use tmux-powerline, you might be able to do something like this.
I customized mcabber to write incoming messages to ~/tmp/mcabber.out and then I created an mcabber segment in ~/etc/tmux-powerline/segments/mcabber:
#!/usr/bin/env bash
segment_path=$(dirname $0)
source "$segment_path/../lib.sh"
echo $(roll_stuff "$(cat ~/tmp/mcabber.out)" 100 1)
exit 0
Of course I created an entry in my status-left:
declare -A mcabber
mcabber+=(["script"]="${segments_path}/mcabber")
mcabber+=(["foreground"]="colour1")
mcabber+=(["background"]="colour0")
mcabber+=(["separator"]="${default}")
register_segment "mcabber"
I name the window that contains mcabber to 'chat'. To mark a message as read I look at the output of $(list-windows) and see if that chat window is active in ~/bin/mcabber_mark_read:
#!/usr/bin/env bash
sleep 5
# check to see that among the tmux windows, the active one is called 'chat'
tmux list-windows | grep chat | grep -q '(active)$'
if [[ $? -eq 0 ]]; then
rm ~/tmp/mcabber.out
fi
In my .tmux.conf I use the status bar to run ~/bin/mcabber_mark_read whenever I change window:
set-window-option -g window-status-current-format '[#(~/bin/mcabber_mark_read)#I:#W#F]'
I don't program in perl nor do I use irssi, but with a few minutes of reading the man pages and using the googles, I might have a solution that'll work for irssi; NB that this is untested:
$ mkdir -p ~/.irssi/scripts/autorun
$ cp /usr/share/irssi/scripts/msg-event.pl ~/.irssi/scripts/autorun/msg-event.pl
and then I edited msg-evnt.pl to look like this:
use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
sub event_msg {
my ($server, $data, $nick, $host) = @_;
open(MYFILE, '>', '~/tmp/mcabber.out');
print MYFILE $text;
close(MYFILE)
}
#Irssi::signal_add('event privmsg', 'event_msg');
Irssi::signal_add('event pubmsg', 'event_msg');
I'm not sure whether you want to be notified of all or just private messages, so chose appropriately.
notify
sub send a tmux notification.