6

I'm successfully using Irssi inside tmux to manage my chats. I've also tried the great tmux-powerline, which seems really full-featured.

Now, I'm wondering if there is a method to make tmux notify me when someone sends me a message in the Irssi window in tmux.

1
  • I think someone could modify this irssi notifications script to make the notify sub send a tmux notification.
    – user49740
    Feb 6, 2013 at 10:08

2 Answers 2

1

I wrote an irssi plugin called hilightnotify.pl.

The script runs a configurable command when hilight status is set/removed within irssi. I use it to execute a blinking tray icon when my name is mentioned and kill the icon when hilight status is removed (meaning that I have noted the message), as described in the linked article and the script itself, but one can run what one wants. If the tmux function you are after supports a CLI trigger, it is probably trivially adaptable to your situation.

1
  • Sure, I've seen it, and seems useful, I'll bind it with a Bash script :)
    – fradeve
    Feb 9, 2013 at 8:17
0

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.

1
  • it seems very useful, thanks. now I'm wondering 1) how to write incoming messages in a outfile in IRSSI 2) how your solution handles read messages: it still shows the latest message even if it has been read?
    – fradeve
    Feb 13, 2013 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .