package App::BCVI::NotifyDesktop; use strict; use warnings; use Encode qw(encode decode); sub execute_notify { my($self, $sock) = @_; my $title = "Notification from " . $self->calling_host(); my $message = decode('utf8', $self->read_request_body($sock)); eval { require Desktop::Notify; }; if($@) { warn "Desktop::Notify is not installed.\n\n$title:\n$message\n\n"; return; } my $notify = Desktop::Notify->new(); my $notification = $notify->create( summary => $title, body => $message, timeout => 10000, ); $notification->show(); } App::BCVI->register_command( name => 'notify', description => <<'END_POD' Send a message which will be displayed as a notification on the user's desktop (where the bcvi listener is running). Typically used with the C<--no-path-xlate> option so that any arguments are passed as text strings rather than as a list of filenames. END_POD ); App::BCVI->hook_server_class(); 1;