App-TimeTracker-Gtk2TrayIcon

 view release on metacpan or  search on metacpan

lib/App/TimeTracker/Gtk2TrayIcon.pm  view on Meta::CPAN

        -e 'share/busy.png'
        ? 'share/busy.png'
        : dist_file( 'App-TimeTracker-Gtk2TrayIcon', 'busy.png' );
    Gtk2->init;
    my $img      = Gtk2::Image->new_from_file($lazy);
    my $window   = Gtk2::TrayIcon->new(__PACKAGE__);
    my $eventbox = Gtk2::EventBox->new;
    $eventbox->add($img);

    my $current;
    my $t = AnyEvent->timer(
        after    => 0,
        interval => 5,
        cb       => sub {
            my $task =
                App::TimeTracker::Data::Task->current($storage_location);
            if ($task) {
                $img->set_from_file($busy);
                $current = $task->say_project_tags;
            }
            else {

lib/App/TimeTracker/Gtk2TrayIcon.pm  view on Meta::CPAN

        'enter-notify-event' => sub {
            unless ( $current eq 'nothing' ) {
                my $dialog =
                    Gtk2::MessageDialog->new( $window,
                    [qw/modal destroy-with-parent/],
                    'other', 'none', $current );

                $dialog->set_decorated(0);
                $dialog->set_gravity('south-west');

                my $t = AnyEvent->timer(
                    after => 5,
                    cb    => sub {
                        $dialog->destroy;
                    } );
                my $retval = $dialog->run;
                $dialog->destroy;
            }
        } );
    $window->add($eventbox);
    $window->show_all;



( run in 0.484 second using v1.01-cache-2.11-cpan-49f99fa48dc )