View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Chris Drake > SysTray > SysTray



Annotate this POD

View/Report Bugs
Module Version: 0.13   Source  


SysTray - Perl extension for cross-platform systray support


    use SysTray;
    SysTray::create("my_callback", "/path/to/icon", "tooltip");
    while (1) {
      SysTray::do_events();  # non-blocking
      # do somthing else or sleep for a little while
    # callback sub for receiving systray events
    sub my_callback {
      my $events = shift;
      if ($events & SysTray::MB_LEFT_CLICK) {
        # do something on left click


This package provides cross-platform systray functionality. It works with Windows (98 or later), Linux (you must have KDE 3.2/Qt 3.3 or later installed) and Mac (OSX 10.3.9 or later)


None. At this moment you'll have to use fully qualified names.


create ($callback, $icon_path, $tooltip)

Creates a new systray icon.

Parameters: * $callback - sub name that will receive the systray icon events * $icon_path - path to the icon to be dysplayed (must be absolute on Linux, can be relative on Windows/Mac) * $tooltip - text to be displayed when mouse hovers over the icon

Return value: 1 if the icon was successfully created, 0 otherwise

destroy ()

Deletes the systray icon and frees the allocated resources.

do_events ()

Non-blocking processing and dispatching of the system messages for the systray icon. If events occurred the callback provided in the create call will be executed.

change_icon ($icon_path)

Changes the systray icon with the one specified in $icon_path. The same rules apply here as for the create call.

set_tooltip ($tooltip)

Changes the tooltip associated with the systray icon.

clear_tooltip ()

Clear the tooltip associated with the systray icon (if any).

release ()

Releases all GUI allocated resources.

events_callback ($events) [you'll have to provide this]

Sub that must be implemented for receiving events from the Systray icon. The $events parameter is a bit combination of the constants defined in the next section.


Mouse Events:

Key events:

System events:



The script shipped with this distribution.


Copyright (C) 2009 by Chris Drake. Contact details on


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: