Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (29 sloc) 0.94 kb
name 'desktop_notify';
description 'Notify build results using the Desktop Notifications framework on the Linux desktop';
author 'Dagfinn Ilmari Mannsåker';
api_version 0.1;
my $notify;
hook init => sub {
my $args = shift;
$notify = eval { require Desktop::Notify; Desktop::Notify->new }
or $args->{app}->diag("! Couldn't find Desktop::Notify. desktop_notify plugin is disabled.\n");
};
hook install_success => sub {
my $args = shift;
notify($args, "Successfully installed %s");
};
hook build_failure => sub {
my $args = shift;
notify($args, "Building %s failed.");
};
sub notify {
my($args, $template, $is_sticky) = @_;
return unless $notify;
my $dist = "$args->{meta}->{name}-$args->{meta}->{version}";
$dist = $args->{module} if $dist eq '-';
my $msg = sprintf $template, $dist;
$notify->create(
timeout => -1,
summary => $msg,
)->show;
}
Jump to Line
Something went wrong with that request. Please try again.