Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
trayManagerNew
- Have it manage a specific screen with
trayManagerManageScreen
- 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).
- 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 ())
Types
data TrayManager Source
type TrayManagerChild = Ptr EggTrayManagerChild Source
class GObjectClass o => TrayManagerClass o Source
castToTrayManager :: GObjectClass o => o -> TrayManager Source
toTrayManager :: TrayManagerClass o => o -> TrayManager Source
Functions
trayManagerManageScreen :: TrayManager -> Screen -> IO Bool Source
Signals
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.
trayLostSelection :: TrayManagerClass self => Signal self (IO ()) Source
??