Get GNOME 3 popup alerts for IRC
IRC is a great medium but chats are often intermittent and it’s easy to miss messages if your focus is elsewhere. Lately I’ve been using Irssi which is extendible with Perl and I wrote a quick script to create a desktop popup alert any time my IRC username is mentioned in chat, or I receive a private message.
Requirements
Warning, this script has a lot of dependencies. To use it, you’ll need to be running GNOME 3, have Irssi and install Gtk3::Notify. There is an open issue on the Gtk3::Notify tests, so you’ll have to force install it at the command line:
$ cpan -fi Gtk3::Notify
Gtk3::Notify has several C library dependencies, so you’ll need to install those too - your Linux distro’s package manager should have them.
Installation
Unless you’re running any scripts with Irssi already, you’ll need to create a scripts directory, and download gnotify.pl:
$ mkdir ~/.irssi/scripts
$ cd ~/.irssi/scripts
$ curl -O https://raw.githubusercontent.com/dnmfarrell/irssi/master/gnotify.pl
To have Irssi to autoload the script, create an “autorun” subdirectory with a symlink back to the script:
$ mkdir ~/.irssi/scripts/autorun
$ cd ~/.irssi/scripts/autorun
$ ln -s ../gnotify.pl
Test the script
To make sure gnotify.pl is working, start Irssi and try sending a private message to yourself from within Irssi:
/msg username hey this is a test message
Just replace username with your own IRC username, for me it looks like this:
At the bottom of the screen you can see the popup alert.
Conclusion
Apart from desktop alerts, there are myriad ways to send IRC alerts: sounds, email and sms. A more sophisticated solution would be to write a script that uses a cloud-based notification service that could then transmit the alerts across all of these channels to the end user.
What types of IRC alerts do you use? Let us know on Reddit.
This article was originally posted on PerlTricks.com.
Tags
David Farrell
David is the editor of Perl.com. An organizer of the New York Perl Meetup, he works for ZipRecruiter as a software developer, and sometimes tweets about Perl and Open Source.
Browse their articles
Feedback
Something wrong with this article? Help us out by opening an issue or pull request on GitHub