Skip to content

Instantly share code, notes, and snippets.

@ajoergensen
Created January 4, 2021 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajoergensen/698e5c8ebf9cca66a03ec44499034ee4 to your computer and use it in GitHub Desktop.
Save ajoergensen/698e5c8ebf9cca66a03ec44499034ee4 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use Desktop::Notify;
use IPC::Message::Minivan;
use Encode;
my $notify_timeout = 500;
my $icon = "/usr/share/pixmaps/pidgin/protocols/scalable/irc.svg";
#my $icon = "gnome-irc.png";
my $van = IPC::Message::Minivan->new(host => 'localhost');
$van->subscribe("#irssi");
our $notify = Desktop::Notify->new();
my $notification = $notify->create(summary => 'Minivan', body => 'Connection established', timeout => $notify_timeout, app_icon => $icon);
$notification->show();
while (1) {
if (my $cmd = $van->get(5,[])) {
if ($cmd->[0] eq '#irssi') {
my $c=$cmd->[1];
my $message = Encode::encode("utf-8",$c->{msg});
my $summary = $c->{summary};
$notification->summary($summary);
$notification->body($message);
$notification->show();
}
}
}
$notification->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment