libnotify-0.1.1.0: Bindings to libnotify library

Safe HaskellNone
LanguageHaskell2010

Libnotify

Contents

Description

High level interface to libnotify API

Synopsis

Notification API

data Notification Source

Notification object

display :: Mod Notification -> IO Notification Source

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

data Mod a Source

A notification modifier

Instances

summary :: String -> Mod Notification Source

Set notification summary

>>> display_ (summary "Hello!")

body :: String -> Mod Notification Source

Set notification body

>>> display_ (body "Hello world!")

icon :: String -> Mod Notification Source

Set notification icon

>>> display_ (icon "face-smile")

The argument is either icon name or file name

timeout :: Timeout -> Mod Notification Source

Set notification timeout

data Timeout Source

Timeout after which notification is closed

Constructors

Default

Default server timeout

Custom Int

User defined timeout (in milliseconds)

Infinite

Notification will never expire

category :: String -> Mod Notification Source

Set notification category

urgency :: Urgency -> Mod Notification Source

Set notification urgency

data Urgency Source

The urgency level of the notification

Constructors

Low

Low urgency. Used for unimportant notifications

Normal

Normal urgency. Used for most standard notifications

Critical

Critical urgency. Used for very important notifications

image :: Pixbuf -> Mod Notification Source

Set notification image

class Hint v where Source

Add a hint to notification

It's perfectly OK to add multiple hints to a single notification

Methods

hint :: String -> v -> Mod Notification Source

nohints :: Mod Notification Source

Remove all hints from the notification

action Source

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 Source

Remove all actions from the notification

>>> let callback _ _ = return ()
>>> display_ (summary "No hello for you!" <> action "hello" "Hello world!" callback <> noactions)

reuse :: Notification -> Mod Notification Source

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

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 newtypes and make those instances of Monoid, e.g. Sum and Product.

Minimal complete definition

mempty, mappend

Methods

mempty :: a

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

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] 
Ord a => Monoid (Max a) 
Ord a => Monoid (Min 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 a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Monoid (IntMap a) 
Ord a => Monoid (Set a) 
Monoid (Seq a) 
Monoid (Mod a) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
Monoid a => Monoid (Const a b) 
Monoid (Proxy k s) 
Ord k => Monoid (Map k v) 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
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) 

(<>) :: Monoid m => m -> m -> m infixr 6

An infix synonym for mappend.

Since: 4.5.0.0