Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.Notification
Description
GNotification
is a mechanism for creating a notification to be shown
to the user — typically as a pop-up notification presented by the
desktop environment shell.
The key difference between GNotification
and other similar APIs is
that, if supported by the desktop environment, notifications sent
with GNotification
will persist after the application has exited,
and even across system reboots.
Since the user may click on a notification while the application is
not running, applications using GNotification
should be able to be
started as a D-Bus service, using Application
.
In order for GNotification
to work, the application must have installed
a .desktop
file. For example:
[Desktop Entry] Name=Test Application Comment=Description of what Test Application does Exec=gnome-test-application Icon=org.gnome.TestApplication Terminal=false Type=Application Categories=GNOME;GTK;TestApplication Category; StartupNotify=true DBusActivatable=true X-GNOME-UsesNotifications=true
The X-GNOME-UsesNotifications
key indicates to GNOME Control Center
that this application uses notifications, so it can be listed in the
Control Center’s ‘Notifications’ panel.
The .desktop
file must be named as org.gnome.TestApplication.desktop
,
where org.gnome.TestApplication
is the ID passed to
applicationNew
.
User interaction with a notification (either the default action, or
buttons) must be associated with actions on the application (ie:
app.
actions). It is not possible to route user interaction
through the notification itself, because the object will not exist if
the application is autostarted as a result of a notification being
clicked.
A notification can be sent with applicationSendNotification
.
Since: 2.40
Synopsis
- newtype Notification = Notification (ManagedPtr Notification)
- class (GObject o, IsDescendantOf Notification o) => IsNotification o
- toNotification :: (MonadIO m, IsNotification o) => o -> m Notification
- type family ResolveNotificationMethod (t :: Symbol) o where ...
- data NotificationAddButtonMethodInfo
- notificationAddButton :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Text -> m ()
- data NotificationAddButtonWithTargetMethodInfo
- notificationAddButtonWithTarget :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Text -> Maybe GVariant -> m ()
- notificationNew :: (HasCallStack, MonadIO m) => Text -> m Notification
- data NotificationSetBodyMethodInfo
- notificationSetBody :: (HasCallStack, MonadIO m, IsNotification a) => a -> Maybe Text -> m ()
- data NotificationSetCategoryMethodInfo
- notificationSetCategory :: (HasCallStack, MonadIO m, IsNotification a) => a -> Maybe Text -> m ()
- data NotificationSetDefaultActionMethodInfo
- notificationSetDefaultAction :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> m ()
- data NotificationSetDefaultActionAndTargetMethodInfo
- notificationSetDefaultActionAndTarget :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> Maybe GVariant -> m ()
- data NotificationSetIconMethodInfo
- notificationSetIcon :: (HasCallStack, MonadIO m, IsNotification a, IsIcon b) => a -> b -> m ()
- data NotificationSetPriorityMethodInfo
- notificationSetPriority :: (HasCallStack, MonadIO m, IsNotification a) => a -> NotificationPriority -> m ()
- data NotificationSetTitleMethodInfo
- notificationSetTitle :: (HasCallStack, MonadIO m, IsNotification a) => a -> Text -> m ()
- data NotificationSetUrgentMethodInfo
- notificationSetUrgent :: (HasCallStack, MonadIO m, IsNotification a) => a -> Bool -> m ()
Exported types
newtype Notification Source #
Memory-managed wrapper type.
Constructors
Notification (ManagedPtr Notification) |
Instances
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.Gio.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
addButton, addButtonWithTarget, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getProperty, getQdata.
Setters
setBody, setCategory, setData, setDataFull, setDefaultAction, setDefaultActionAndTarget, setIcon, setPriority, setProperty, setTitle, setUrgent.
type family ResolveNotificationMethod (t :: Symbol) o where ... Source #
Equations
addButton
data NotificationAddButtonMethodInfo Source #
Instances
(signature ~ (Text -> Text -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationAddButtonMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationAddButtonMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationAddButton Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Adds a button to notification
that activates the action in
detailedAction
when clicked. That action must be an
application-wide action (starting with "app."). If detailedAction
contains a target, the action will be activated with that target as
its parameter.
See actionParseDetailedName
for a description of the format
for detailedAction
.
Since: 2.40
addButtonWithTarget
data NotificationAddButtonWithTargetMethodInfo Source #
Instances
(signature ~ (Text -> Text -> Maybe GVariant -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationAddButtonWithTargetMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationAddButtonWithTargetMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationAddButtonWithTarget Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant | |
-> m () |
Adds a button to notification
that activates action
when clicked.
action
must be an application-wide action (it must start with "app.").
If target
is non-Nothing
, action
will be activated with target
as
its parameter.
Since: 2.40
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Notification | Returns: a new |
Creates a new Notification
with title
as its title.
After populating notification
with more details, it can be sent to
the desktop shell with applicationSendNotification
. Changing
any properties after this call will not have any effect until
resending notification
.
Since: 2.40
setBody
data NotificationSetBodyMethodInfo Source #
Instances
(signature ~ (Maybe Text -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetBodyMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetBodyMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the body of notification
to body
.
Since: 2.40
setCategory
data NotificationSetCategoryMethodInfo Source #
Instances
(signature ~ (Maybe Text -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetCategoryMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetCategoryMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationSetCategory Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the type of notification
to category
. Categories have a main
type like email
, im
or device
and can have a detail separated
by a .
, e.g. im.received
or email.arrived
. Setting the category
helps the notification server to select proper feedback to the user.
Standard categories are listed in the specification.
Since: 2.70
setDefaultAction
data NotificationSetDefaultActionMethodInfo Source #
Instances
(signature ~ (Text -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetDefaultActionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetDefaultActionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationSetDefaultAction Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the default action of notification
to detailedAction
. This
action is activated when the notification is clicked on.
The action in detailedAction
must be an application-wide action (it
must start with "app."). If detailedAction
contains a target, the
given action will be activated with that target as its parameter.
See actionParseDetailedName
for a description of the format
for detailedAction
.
When no default action is set, the application that the notification was sent on is activated.
Since: 2.40
setDefaultActionAndTarget
data NotificationSetDefaultActionAndTargetMethodInfo Source #
Instances
(signature ~ (Text -> Maybe GVariant -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetDefaultActionAndTargetMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetDefaultActionAndTargetMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationSetDefaultActionAndTarget Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> Maybe GVariant | |
-> m () |
Sets the default action of notification
to action
. This action is
activated when the notification is clicked on. It must be an
application-wide action (start with "app.").
If target
is non-Nothing
, action
will be activated with target
as
its parameter. If target
is floating, it will be consumed.
When no default action is set, the application that the notification was sent on is activated.
Since: 2.40
setIcon
data NotificationSetIconMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsNotification a, IsIcon b) => OverloadedMethod NotificationSetIconMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetIconMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
Arguments
:: (HasCallStack, MonadIO m, IsNotification a, IsIcon b) | |
=> a |
|
-> b |
|
-> m () |
Sets the icon of notification
to icon
.
Since: 2.40
setPriority
data NotificationSetPriorityMethodInfo Source #
Instances
(signature ~ (NotificationPriority -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetPriorityMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetPriorityMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationSetPriority Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> NotificationPriority |
|
-> m () |
Sets the priority of notification
to priority
. See
NotificationPriority
for possible values.
setTitle
data NotificationSetTitleMethodInfo Source #
Instances
(signature ~ (Text -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetTitleMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetTitleMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the title of notification
to title
.
Since: 2.40
setUrgent
data NotificationSetUrgentMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsNotification a) => OverloadedMethod NotificationSetUrgentMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Notification Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo NotificationSetUrgentMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Notification Methods |
notificationSetUrgent Source #
Arguments
:: (HasCallStack, MonadIO m, IsNotification a) | |
=> a |
|
-> Bool |
|
-> m () |
Deprecated: (Since version 2.42)Since 2.42, this has been deprecated in favour ofnotificationSetPriority
.
Deprecated in favor of notificationSetPriority
.
Since: 2.40