We fasten the hilight notification in irssi via notify-osd

    Due to the support of perl-scripting in Irssi, it is possible in a very simple way, without using any additional modules or something else, to implement a rather convenient function of notifying about private messages and highlights via notify-osd using the script given here. Of course, you can use anything instead of notify-osd as you wish, and then this will be just a small example of how you can ennoble such a seemingly wretched, at first glance, IRC client.


    #! / usr / bin / perl -w -C
    use strict;
    use Irssi;
    use Irssi :: Irc;
    sub sig_public 
    {
            my @host;
            my ($ server, $ msg, $ nick, $ address, $ target) = @_;
            my $ mynick = $ server -> {nick};
            chomp $ mynick;
            if ($ msg = ~ m /.*$ mynick. * /)
            {
                    # Replacing different special characters with more understandable ones for notify-osd
                    $ msg = ~ s / /> /;
                    $ msg = ~ s / '/ `/ g;
                    system ("/ usr / bin / notify-send 'Irssi: $ nick [$ target]' '$ msg'");
            }
    }
    sub sig_private 
    {
            my ($ server, $ msg, $ nick, $ address) = @_;
            system ("/ usr / bin / notify-send 'Irssi: $ nick [private]' '$ msg'");
    }
    Irssi :: signal_add_last ('message public', 'sig_public');
    Irssi :: signal_add_last ('message private', 'sig_private');
    


    Of course, this only works if the client is running locally on your machine, and not in screen on the remote server.

    PS Found and fixed a bug with a double notification about highlights on the channel.

    Also popular now: