Safe Haskell | None |
---|
High level interface to libnotify API
- data Notification
- display :: Mod Notification -> IO Notification
- display_ :: Mod Notification -> IO ()
- close :: Notification -> IO ()
- data Mod a
- summary :: String -> Mod Notification
- body :: String -> Mod Notification
- icon :: String -> Mod Notification
- timeout :: Timeout -> Mod Notification
- data Timeout
- category :: String -> Mod Notification
- urgency :: Urgency -> Mod Notification
- data Urgency
- image :: Pixbuf -> Mod Notification
- class Hint v where
- hint :: String -> v -> Mod Notification
- nohints :: Mod Notification
- action :: String -> String -> (Notification -> String -> IO a) -> Mod Notification
- noactions :: Mod Notification
- reuse :: Notification -> Mod Notification
- class Monoid a where
- (<>) :: Monoid m => m -> m -> m
Notification API
display :: Mod Notification -> IO NotificationSource
Display notification
>>>
token <- display (summary "Greeting" <> body "Hello world!" <> icon "face-smile-big")
You can reuse
notification tokens:
>>>
display_ (reuse token <> body "Hey!")
display_ :: Mod Notification -> IO ()Source
Display and discard notification token
>>>
display_ (summary "Greeting" <> body "Hello world!" <> icon "face-smile-big")
close :: Notification -> IO ()Source
Close notification
Modifiers
summary :: String -> Mod NotificationSource
Set notification summary
>>>
display_ (summary "Hello!")
body :: String -> Mod NotificationSource
Set notification body
>>>
display_ (body "Hello world!")
icon :: String -> Mod NotificationSource
Set notification icon
>>>
display_ (icon "face-smile")
The argument is either icon name or file name
timeout :: Timeout -> Mod NotificationSource
Set notification timeout
Timeout after which notification is closed
category :: String -> Mod NotificationSource
Set notification category
urgency :: Urgency -> Mod NotificationSource
Set notification urgency
The urgency level of the notification
image :: Pixbuf -> Mod NotificationSource
Set notification image
Add a hint to notification
It's perfectly OK to add multiple hints to a single notification
hint :: String -> v -> Mod NotificationSource
nohints :: Mod NotificationSource
Remove all hints from the notification
:: String | Name |
-> String | Button label |
-> (Notification -> String -> IO a) | Callback |
-> Mod Notification |
Add an action to notification
It's perfectly OK to add multiple actions to a single notification
>>>
display_ (action "hello" "Hello world!" (\_ _ -> return ()))
noactions :: Mod NotificationSource
Remove all actions from the notification
>>>
let callback _ _ = return ()
>>>
display_ (summary "No hello for you!" <> action "hello" "Hello world!" callback <> noactions)
reuse :: Notification -> Mod NotificationSource
Reuse existing notification token, instead of creating a new one
If you try to reuse multiple tokens, the last one wins, e.g.
>>>
foo <- display (body "foo")
>>>
bar <- display (body "bar")
>>>
display_ (base foo <> base bar)
will show only "bar"
Convenience re-exports
class Monoid a where
Monoid Ordering | |
Monoid () | |
Monoid ByteString | |
Monoid Any | |
Monoid All | |
Monoid [a] | |
Monoid a => Monoid (Maybe a) | |
Monoid (Endo a) | |
Monoid a => Monoid (Dual a) | |
Num a => Monoid (Sum a) | |
Num a => Monoid (Product a) | |
Monoid (Last a) | |
Monoid (First a) | |
Monoid (Mod a) | |
Monoid b => Monoid (a -> b) | |
(Monoid a, Monoid b) => Monoid (a, b) | |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) |