Plagger::Plugin::Notify::Tk
設定とか考えるの面倒だったんでとりあえず骨格だけ。Rule::Freshとかと組み合わせればRSSティッカーになるかな、と。
#Notify空間あるの忘れてました(汗 当然そっちの方がいいですな。
package Plagger::Plugin::Notify::Tk; use strict; use base qw( Plagger::Plugin ); our $VERSION = 0.01; use Tk; use Tk::ROText; sub register { my($self, $context) = @_; $context->register_hook( $self, 'publish.init' => \&init_tk, 'publish.entry' => \&write_tk, 'publish.finalize' => \&show_tk, ); } sub init_tk { my ($self, $context, $args) = @_; $context->log(debug => "hello, Tk"); my $mw = MainWindow->new; my $text = $mw->Scrolled('ROText')->pack(-fill => 'both', -expand => 1); $mw->title('Plagger Ticker'); $text->tagConfigure('title', -underline => 1); $text->tagConfigure('body', -underline => 0); $self->{tk_popup_main} = $mw; $self->{tk_popup_text} = $text; } sub show_tk { my ($self, $context, $args) = @_; MainLoop; $context->log(debug => "good-bye, Tk"); } sub write_tk { my ($self, $context, $args) = @_; my $entry = $args->{entry}; my $text = $self->{tk_popup_text}; my $title = $entry->title_text; my $body = $entry->body_text; $body =~ s/\n\n\n+/\n\n/gs; $text->insert('end', $title, 'title'); $text->insert('end', $body, 'body'); } 1; __END__ =head1 Plagger::Plugin::Notify::Tk - kind of RSS ticker =head1 SYNOPSYS - module: Notify::Tk =head1 CONFIG Currently none. But obviously we need font configuration et al. =head1 AUTHOR Kenichi Ishigaki =head1 SEE ALSO C<Plagger>, C<Tk> =cut