gtk-traymanager-0.1.3: A wrapper around the eggtraymanager library for Linux system trays

Safe HaskellSafe-Infered




This module implements a TrayManager - an integral part of a Linux system tray widget, though it is not itself a widget. This package exports a single GObject (for use with gtk2hs) that implements the system tray specification (it handles receiving events and translating them into convenient signals, along with the messy work of dealing with XEMBED).

The basic usage of the object is to:

  1. Instantiate the object with trayManagerNew
  2. Have it manage a specific screen with trayManagerManageScreen
  3. Set up handlers for the events exposed by the tray (e.g., trayIconAdded).

As an example, a functional system tray widget looks something like:

 import Graphics.UI.Gtk
 import Graphics.UI.Gtk.Misc.TrayManager
 systrayNew = do
   box <- hBoxNew False 5
   trayManager <- rayManagerNew
   Just screen <- screenGetDefault
   trayManagerManageScreen trayManager screen
   on trayManager trayIconAdded $ \w -> do
     widgetShowAll w
     boxPackStart box w PackNatural 0

Note that the widgets made available in the event handlers are not shown by default; you need to explicitly show them if you want that (and you probably do).



type TrayManagerChild = Ptr EggTrayManagerChildSource



trayIconAdded :: TrayManagerClass self => Signal self (Widget -> IO ())Source

The signal emitted when a new tray icon is added. These are delivered even for systray icons that already exist when the tray manager is created.

trayIconRemoved :: TrayManagerClass self => Signal self (Widget -> IO ())Source

This signal is emitted when a tray icon is removed by its parent application. No action is really necessary here (the icon is removed without any intervention). You could do something here if you wanted, though.

trayMessageSent :: TrayManagerClass self => Signal self (Widget -> String -> Int64 -> Int64 -> IO ())Source

This signal is emitted when the application that displayed an icon wants a semi-persistent notification displayed for its icon. The standard doesn't seem to require that these be honored.

trayMessageCanceled :: TrayManagerClass self => Signal self (Widget -> Int64 -> IO ())Source

Similarly, the applciation can send this to cancel a previous persistent message.