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 freedesktop.org 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:
- Instantiate the object with
- Have it manage a specific screen with
- Set up handlers for the events exposed by the tray (e.g.,
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).
- data TrayManager
- type TrayManagerChild = Ptr EggTrayManagerChild
- class GObjectClass o => TrayManagerClass o
- castToTrayManager :: GObjectClass o => o -> TrayManager
- toTrayManager :: TrayManagerClass o => o -> TrayManager
- gTypeTrayManager :: GType
- trayManagerCheckRunning :: Screen -> IO Bool
- trayManagerNew :: IO TrayManager
- trayManagerManageScreen :: TrayManager -> Screen -> IO Bool
- trayManagerGetChildTitle :: TrayManager -> TrayManagerChild -> IO String
- trayIconAdded :: TrayManagerClass self => Signal self (Widget -> IO ())
- trayIconRemoved :: TrayManagerClass self => Signal self (Widget -> IO ())
- trayMessageSent :: TrayManagerClass self => Signal self (Widget -> String -> Int64 -> Int64 -> IO ())
- trayMessageCanceled :: TrayManagerClass self => Signal self (Widget -> Int64 -> IO ())
- trayLostSelection :: TrayManagerClass self => Signal self (IO ())
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.
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.
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.
Similarly, the applciation can send this to cancel a previous persistent message.