Win32::SysTray
use strict; use Win32::SysTray; use File::Basename; use File::Spec::Functions qw[ catfile rel2abs updir ]; my $tray = new Win32::SysTray ( 'icon' => rel2abs(dirname($0)).'\img\icon.ico', 'single' => 1, ) or exit 0; $tray->setMenu ( "> &Test" => sub { print "Hello from the Tray\n"; }, ">-" => 0, "> E&xit" => sub { return -1 }, ); $tray->runApplication;
The Win32::SysTray module allows the programmer to create perl applications that are stored in the Windows system tray.
Andreas Mahnke
creates a new object of the class parameters: name: Name of the Tray Application (default -> 'MyTray') tooltip: Text to be displayed when moving the mouse over the tray icon (default -> name attribute) icon: path to *.ico file to be used as icon for the tray (MANDATORY!) single: only one running instance of the application is allowed
sets the popup menu of the tray application which is dislayed when (right)clicking on the icon see synopsis for example of using
run the application (invokes Win32::GUI::Dialog)
To install Win32::SysTray, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::SysTray
CPAN shell
perl -MCPAN -e shell install Win32::SysTray
For more information on module installation, please visit the detailed CPAN module installation guide.