notify.pl 673 B

1234567891011121314151617181920212223242526
  1. use strict;
  2. use Irssi;
  3. use vars qw($VERSION %IRSSI);
  4. $VERSION = "0.01";
  5. %IRSSI = (
  6. authors => 'Luke Macken',
  7. contact => 'lewk@csh.rit.edu',
  8. name => 'notify.pl',
  9. description => 'TODO',
  10. license => 'GNU General Public License',
  11. url => 'http://www.csh.rit.edu/~lewk/code/irssi-notify',
  12. );
  13. sub notify {
  14. my ($dest, $text, $stripped) = @_;
  15. my $server = $dest->{server};
  16. return if (!$server || !($dest->{level} & MSGLEVEL_HILIGHT));
  17. $stripped =~ s/[^a-zA-Z0-9 .,!?\@:\>]//g;
  18. system("notify-send -i gtk-dialog-info -t 5000 '$dest->{target}' '$stripped'");
  19. }
  20. Irssi::signal_add('print text', 'notify');