1

added desktop notification script for hexchat

This commit is contained in:
eleksir
2016-09-18 02:35:57 +03:00
parent 753c2ca851
commit 9de78532a6

24
hexchat-notification.pl Normal file
View File

@@ -0,0 +1,24 @@
use strict;
use warnings "all";
sub hookfn;
my $script_name = "Notification plugin";
HexChat::register($script_name, '0.1', 'Sends *nix desktop notifications');
HexChat::print("$script_name loaded\n");
HexChat::hook_print('Channel Message', \&hookfn);
HexChat::hook_print('Channel Msg Hilight', \&hookfn);
HexChat::hook_print('Channel Action', \&hookfn);
HexChat::hook_print('Channel Action Hilight', \&hookfn);
sub hookfn {
my ($nick, $text, $modechar) = @{$_[0]};
my $channel = HexChat::get_info('channel');
$channel = '' unless(defined($channel));
$nick = '' unless(defined($nick));
$text = '' unless(defined($text));
$text =~ s/\"/\\"/g;
my $topic = sprintf("%s at %s says:", $nick, $channel);
`notify-send -u normal -t 10000 -a hexchat "$topic" -i hexchat "$text" &`;
return HexChat::EAT_NONE;
}