Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A passive pop-up notification.
Notification
represents a passive pop-up notification. It can
contain summary text, body text, and an icon, as well as hints specifying
how the notification should be presented. The notification is rendered
by a notification daemon, and may present the notification in any number
of ways. As such, there is a clear separation of content and presentation,
and this API enforces that.
Synopsis
- newtype Notification = Notification (ManagedPtr Notification)
- class (GObject o, IsDescendantOf Notification o) => IsNotification o
- toNotification :: (MonadIO m, IsNotification o) => o -> m Notification
- notificationAddAction :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Text -> ActionCallback -> m ()
- notificationClearActions :: (HasCallStack, MonadIO m, IsNotification a) => a -> m ()
- notificationClearHints :: (HasCallStack, MonadIO m, IsNotification a) => a -> m ()
- notificationClose :: (HasCallStack, MonadIO m, IsNotification a) => a -> m ()
- notificationGetActivationToken :: (HasCallStack, MonadIO m, IsNotification a) => a -> m (Maybe Text)
- notificationGetClosedReason :: (HasCallStack, MonadIO m, IsNotification a) => a -> m Int32
- notificationNew :: (HasCallStack, MonadIO m) => Text -> Maybe Text -> Maybe Text -> m Notification
- notificationSetAppName :: (HasCallStack, MonadIO m, IsNotification a) => a -> Maybe Text -> m ()
- notificationSetCategory :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> m ()
- notificationSetHint :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Maybe GVariant -> m ()
- notificationSetHintByte :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Word8 -> m ()
- notificationSetHintByteArray :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> ByteString -> m ()
- notificationSetHintDouble :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Double -> m ()
- notificationSetHintInt32 :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Int32 -> m ()
- notificationSetHintString :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Text -> m ()
- notificationSetHintUint32 :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Word32 -> m ()
- notificationSetIconFromPixbuf :: (HasCallStack, MonadIO m, IsNotification a, IsPixbuf b) => a -> b -> m ()
- notificationSetImageFromPixbuf :: (HasCallStack, MonadIO m, IsNotification a, IsPixbuf b) => a -> b -> m ()
- notificationSetTimeout :: (HasCallStack, MonadIO m, IsNotification a) => a -> Int32 -> m ()
- notificationSetUrgency :: (HasCallStack, MonadIO m, IsNotification a) => a -> Urgency -> m ()
- notificationShow :: (HasCallStack, MonadIO m, IsNotification a) => a -> m ()
- notificationUpdate :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Maybe Text -> Maybe Text -> m Bool
- clearNotificationAppName :: (MonadIO m, IsNotification o) => o -> m ()
- constructNotificationAppName :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o)
- getNotificationAppName :: (MonadIO m, IsNotification o) => o -> m (Maybe Text)
- setNotificationAppName :: (MonadIO m, IsNotification o) => o -> Text -> m ()
- clearNotificationBody :: (MonadIO m, IsNotification o) => o -> m ()
- constructNotificationBody :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o)
- getNotificationBody :: (MonadIO m, IsNotification o) => o -> m (Maybe Text)
- setNotificationBody :: (MonadIO m, IsNotification o) => o -> Text -> m ()
- getNotificationClosedReason :: (MonadIO m, IsNotification o) => o -> m Int32
- clearNotificationIconName :: (MonadIO m, IsNotification o) => o -> m ()
- constructNotificationIconName :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o)
- getNotificationIconName :: (MonadIO m, IsNotification o) => o -> m (Maybe Text)
- setNotificationIconName :: (MonadIO m, IsNotification o) => o -> Text -> m ()
- constructNotificationId :: (IsNotification o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getNotificationId :: (MonadIO m, IsNotification o) => o -> m Int32
- setNotificationId :: (MonadIO m, IsNotification o) => o -> Int32 -> m ()
- clearNotificationSummary :: (MonadIO m, IsNotification o) => o -> m ()
- constructNotificationSummary :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o)
- getNotificationSummary :: (MonadIO m, IsNotification o) => o -> m (Maybe Text)
- setNotificationSummary :: (MonadIO m, IsNotification o) => o -> Text -> m ()
- type NotificationClosedCallback = IO ()
- afterNotificationClosed :: (IsNotification a, MonadIO m) => a -> ((?self :: a) => NotificationClosedCallback) -> m SignalHandlerId
- onNotificationClosed :: (IsNotification a, MonadIO m) => a -> ((?self :: a) => NotificationClosedCallback) -> m SignalHandlerId
Exported types
newtype Notification Source #
Memory-managed wrapper type.
Notification (ManagedPtr Notification) |
Instances
Eq Notification Source # | |
Defined in GI.Notify.Objects.Notification (==) :: Notification -> Notification -> Bool # (/=) :: Notification -> Notification -> Bool # | |
GObject Notification Source # | |
Defined in GI.Notify.Objects.Notification | |
ManagedPtrNewtype Notification Source # | |
Defined in GI.Notify.Objects.Notification toManagedPtr :: Notification -> ManagedPtr Notification | |
TypedObject Notification Source # | |
Defined in GI.Notify.Objects.Notification | |
HasParentTypes Notification Source # | |
Defined in GI.Notify.Objects.Notification | |
IsGValue (Maybe Notification) Source # | Convert |
Defined in GI.Notify.Objects.Notification gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Notification -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Notification) | |
type ParentTypes Notification Source # | |
Defined in GI.Notify.Objects.Notification type ParentTypes Notification = '[Object] |
class (GObject o, IsDescendantOf Notification o) => IsNotification o Source #
Type class for types which can be safely cast to Notification
, for instance with toNotification
.
Instances
(GObject o, IsDescendantOf Notification o) => IsNotification o Source # | |
Defined in GI.Notify.Objects.Notification |
toNotification :: (MonadIO m, IsNotification o) => o -> m Notification Source #
Cast to Notification
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
addAction, bindProperty, bindPropertyFull, clearActions, clearHints, close, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, show, stealData, stealQdata, thawNotify, unref, update, watchClosure.
Getters
getActivationToken, getClosedReason, getData, getProperty, getQdata.
Setters
setAppName, setCategory, setData, setDataFull, setHint, setHintByte, setHintByteArray, setHintDouble, setHintInt32, setHintString, setHintUint32, setIconFromPixbuf, setImageFromPixbuf, setProperty, setTimeout, setUrgency.
addAction
notificationAddAction Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> ActionCallback |
|
-> m () |
Adds an action to a notification.
When the action is invoked, the specified callback function will be called,
along with the value passed to userData
.
clearActions
notificationClearActions Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m () |
Clears all actions from the notification.
clearHints
notificationClearHints Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m () |
Clears all hints from the notification.
close
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m () | (Can throw |
Synchronously tells the notification server to hide the notification on the screen.
getActivationToken
notificationGetActivationToken Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m (Maybe Text) | Returns: The current activation token, or |
Gets the activation token of the notification.
If an an action is currently being activated, return the activation token.
This function is intended to be used in a [callbackactionCallback
] to get
the activation token for the activated action, if the notification daemon
supports it.
Since: 0.7.10
getClosedReason
notificationGetClosedReason Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m Int32 | Returns: An integer representing the closed reason code
(Since 0.8.0 it's also a [enum |
Returns the closed reason code for the notification.
This is valid only after the signalnotification
[closed] signal is emitted.
Since version 0.8.0 the returned value is of type [enumclosedReason
].
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m Notification | Returns: The new |
Creates a new Notification
.
The summary text is required, but all other parameters are optional.
setAppName
notificationSetAppName Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the application name for the notification.
If this function is not called or if appName
is Nothing
, the application name
will be set from the value used in [funcinit
] or overridden with
[funcsetAppName
].
Since: 0.7.3
setCategory
notificationSetCategory Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the category of this notification.
This can be used by the notification server to filter or display the data in a certain way.
setHint
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Maybe GVariant |
|
-> m () |
Sets a hint for key
with value value
.
If value
is Nothing
, a previously set hint for key
is unset.
If value
is floating, it is consumed.
Since: 0.6
setHintByte
notificationSetHintByte Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Word8 |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with a byte value.
setHintByteArray
notificationSetHintByteArray Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> ByteString |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with a byte array value.
The length of value
must be passed as len
.
setHintDouble
notificationSetHintDouble Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Double |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with a double value.
setHintInt32
notificationSetHintInt32 Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with a 32-bit integer value.
setHintString
notificationSetHintString Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with a string value.
setHintUint32
notificationSetHintUint32 Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Word32 |
|
-> m () |
Deprecated: (Since version 0.6.)Use [methodnotification
.set_hint] instead
Sets a hint with an unsigned 32-bit integer value.
setIconFromPixbuf
notificationSetIconFromPixbuf Source #
:: (HasCallStack, MonadIO m, IsNotification a, IsPixbuf b) | |
=> a |
|
-> b |
|
-> m () |
Deprecated: (Since version 0.5.)Use [methodnotification
.set_image_from_pixbuf] instead.
Sets the icon in the notification from a Pixbuf
.
setImageFromPixbuf
notificationSetImageFromPixbuf Source #
:: (HasCallStack, MonadIO m, IsNotification a, IsPixbuf b) | |
=> a |
|
-> b |
|
-> m () |
Sets the image in the notification from a Pixbuf
.
Since: 0.5
setTimeout
notificationSetTimeout Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the timeout of the notification.
To set the default time, pass EXPIRES_DEFAULT
as timeout
. To set the
notification to never expire, pass EXPIRES_NEVER
.
Note that the timeout may be ignored by the server.
setUrgency
notificationSetUrgency Source #
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Urgency |
|
-> m () |
Sets the urgency level of this notification.
show
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> m () | (Can throw |
Tells the notification server to display the notification on the screen.
update
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Updates the notification text and icon.
This won't send the update out and display it on the screen. For that, you
will need to call [methodnotification
.show].
Properties
appName
The name of the application for the notification.
Since: 0.7.3
clearNotificationAppName :: (MonadIO m, IsNotification o) => o -> m () Source #
Set the value of the “app-name
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#appName
constructNotificationAppName :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “app-name
” property. This is rarely needed directly, but it is used by new
.
getNotificationAppName :: (MonadIO m, IsNotification o) => o -> m (Maybe Text) Source #
Get the value of the “app-name
” property.
When overloading is enabled, this is equivalent to
get
notification #appName
setNotificationAppName :: (MonadIO m, IsNotification o) => o -> Text -> m () Source #
Set the value of the “app-name
” property.
When overloading is enabled, this is equivalent to
set
notification [ #appName:=
value ]
body
The body of the notification.
clearNotificationBody :: (MonadIO m, IsNotification o) => o -> m () Source #
Set the value of the “body
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#body
constructNotificationBody :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “body
” property. This is rarely needed directly, but it is used by new
.
getNotificationBody :: (MonadIO m, IsNotification o) => o -> m (Maybe Text) Source #
Get the value of the “body
” property.
When overloading is enabled, this is equivalent to
get
notification #body
setNotificationBody :: (MonadIO m, IsNotification o) => o -> Text -> m () Source #
Set the value of the “body
” property.
When overloading is enabled, this is equivalent to
set
notification [ #body:=
value ]
closedReason
The closed reason of the notification.
getNotificationClosedReason :: (MonadIO m, IsNotification o) => o -> m Int32 Source #
Get the value of the “closed-reason
” property.
When overloading is enabled, this is equivalent to
get
notification #closedReason
iconName
The icon-name of the icon to be displayed on the notification.
clearNotificationIconName :: (MonadIO m, IsNotification o) => o -> m () Source #
Set the value of the “icon-name
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#iconName
constructNotificationIconName :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-name
” property. This is rarely needed directly, but it is used by new
.
getNotificationIconName :: (MonadIO m, IsNotification o) => o -> m (Maybe Text) Source #
Get the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
get
notification #iconName
setNotificationIconName :: (MonadIO m, IsNotification o) => o -> Text -> m () Source #
Set the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
set
notification [ #iconName:=
value ]
id
The Id of the notification.
constructNotificationId :: (IsNotification o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “id
” property. This is rarely needed directly, but it is used by new
.
getNotificationId :: (MonadIO m, IsNotification o) => o -> m Int32 Source #
Get the value of the “id
” property.
When overloading is enabled, this is equivalent to
get
notification #id
setNotificationId :: (MonadIO m, IsNotification o) => o -> Int32 -> m () Source #
Set the value of the “id
” property.
When overloading is enabled, this is equivalent to
set
notification [ #id:=
value ]
summary
The summary of the notification.
clearNotificationSummary :: (MonadIO m, IsNotification o) => o -> m () Source #
Set the value of the “summary
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#summary
constructNotificationSummary :: (IsNotification o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “summary
” property. This is rarely needed directly, but it is used by new
.
getNotificationSummary :: (MonadIO m, IsNotification o) => o -> m (Maybe Text) Source #
Get the value of the “summary
” property.
When overloading is enabled, this is equivalent to
get
notification #summary
setNotificationSummary :: (MonadIO m, IsNotification o) => o -> Text -> m () Source #
Set the value of the “summary
” property.
When overloading is enabled, this is equivalent to
set
notification [ #summary:=
value ]
Signals
closed
type NotificationClosedCallback = IO () Source #
Emitted when the notification is closed.
afterNotificationClosed :: (IsNotification a, MonadIO m) => a -> ((?self :: a) => NotificationClosedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
notification #closed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onNotificationClosed :: (IsNotification a, MonadIO m) => a -> ((?self :: a) => NotificationClosedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
notification #closed callback