Safe Haskell | None |
---|---|
Language | Haskell2010 |
Libnotify
Description
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
- nohints :: Mod Notification
- action :: String -> String -> (Notification -> String -> IO a) -> Mod Notification
- noactions :: Mod Notification
- appName :: String -> Mod Notification
- reuse :: Notification -> Mod Notification
- class Monoid a where
- (<>) :: Monoid m => m -> m -> m
Notification API
display :: Mod Notification -> IO Notification #
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 () #
Display and discard notification token
>>>
display_ (summary "Greeting" <> body "Hello world!" <> icon "face-smile-big")
close :: Notification -> IO () #
Close notification
Modifiers
summary :: String -> Mod Notification #
Set notification summary
>>>
display_ (summary "Hello!")
body :: String -> Mod Notification #
Set notification body
>>>
display_ (body "Hello world!")
icon :: String -> Mod Notification #
Set notification icon
>>>
display_ (icon "face-smile")
The argument is either icon name or file name
timeout :: Timeout -> Mod Notification #
Set notification timeout
Timeout after which notification is closed
category :: String -> Mod Notification #
Set notification category
urgency :: Urgency -> Mod Notification #
Set notification urgency
The urgency level of the notification
image :: Pixbuf -> Mod Notification #
Set notification image
Add a hint to notification
It's perfectly OK to add multiple hints to a single notification
Minimal complete definition
Methods
hint :: String -> v -> Mod Notification #
nohints :: Mod Notification #
Remove all hints from the notification
Arguments
:: 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 Notification #
Remove all actions from the notification
>>>
let callback _ _ = return ()
>>>
display_ (summary "No hello for you!" <> action "hello" "Hello world!" callback <> noactions)
appName :: String -> Mod Notification #
Set the application name.
reuse :: Notification -> Mod Notification #
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
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat =
foldr
mappend mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
Methods
Identity of mappend
An associative operation
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
Instances
Monoid Ordering | |
Monoid () | |
Monoid All | |
Monoid Any | |
Monoid ByteString | |
Monoid IntSet | |
Monoid [a] | |
Monoid a => Monoid (Maybe a) | Lift a semigroup into |
Monoid a => Monoid (IO a) | |
Ord a => Monoid (Max a) | |
Ord a => Monoid (Min a) | |
Monoid a => Monoid (Identity a) | |
(Ord a, Bounded a) => Monoid (Min a) | |
(Ord a, Bounded a) => Monoid (Max a) | |
Monoid m => Monoid (WrappedMonoid m) | |
Semigroup a => Monoid (Option a) | |
Monoid a => Monoid (Dual a) | |
Monoid (Endo a) | |
Num a => Monoid (Sum a) | |
Num a => Monoid (Product a) | |
Monoid (First a) | |
Monoid (Last a) | |
Monoid (IntMap a) | |
Monoid (Seq a) | |
Ord a => Monoid (Set a) | |
Monoid (Mod a) # | |
Monoid b => Monoid (a -> b) | |
(Monoid a, Monoid b) => Monoid (a, b) | |
Monoid (Proxy k s) | |
Ord k => Monoid (Map k v) | |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | |
Monoid a => Monoid (Const k a b) | |
Alternative f => Monoid (Alt * f a) | |
(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) | |