taffybar-4.0.2: A desktop bar similar to xmobar, but with more GUI

Safe Haskell | Safe-Inferred
Language | Haskell2010

System.Taffybar.Widget.FreedesktopNotifications

Description

This widget listens on DBus for freedesktop notifications (http://developer.gnome.org/notification-spec/). Currently it is somewhat ugly, but the format is somewhat configurable.

The widget only displays one notification at a time and notifications are cancellable.

The notificationDaemon thread handles new notifications and cancellation requests, adding or removing the notification to or from the queue. It additionally starts a timeout thread for each notification added to queue.

The display thread blocks idling until it is awakened to refresh the GUI

A timeout thread is associated with a notification id. It sleeps until the specific timeout and then removes every notification with that id from the queue

Synopsis

- data Notification = Notification {
  - noteAppName :: Text
  - noteReplaceId :: Word32
  - noteSummary :: Text
  - noteBody :: Text
  - noteExpireTimeout :: Maybe Int32
  - noteId :: Word32
  }
- data NotificationConfig = NotificationConfig {
  - notificationMaxTimeout :: Maybe Int32
  - notificationMaxLength :: Int
  - notificationFormatter :: [Notification] -> Text
  }
- defaultNotificationConfig :: NotificationConfig
- notifyAreaNew :: MonadIO m => NotificationConfig -> m Widget

# Documentation

data Notification Source #

A simple structure representing a Freedesktop notification

Constructors

Notification |

Fields

- noteAppName :: Text
- noteReplaceId :: Word32
- noteSummary :: Text
- noteBody :: Text
- noteExpireTimeout :: Maybe Int32
- noteId :: Word32

#### Instances

Instances details

Show Notification Source # |
Instance details Defined in System.Taffybar.Widget.FreedesktopNotifications Methods showsPrec :: Int -> Notification -> ShowS Source # show :: Notification -> String Source # showList :: [Notification] -> ShowS Source #
Eq Notification Source # |
Instance details Defined in System.Taffybar.Widget.FreedesktopNotifications Methods (==) :: Notification -> Notification -> Bool Source # (/=) :: Notification -> Notification -> Bool Source #

data NotificationConfig Source #

Constructors

NotificationConfig |

Fields

- notificationMaxTimeout :: Maybe Int32

  Maximum time that a notification will be displayed (in seconds). Default: None

- notificationMaxLength :: Int

  Maximum length displayed, in characters. Default: 100

- notificationFormatter :: [Notification] -> Text

  Function used to format notifications, takes the notifications from first to last

#### Instances

Instances details

Default NotificationConfig Source # |
Instance details Defined in System.Taffybar.Widget.FreedesktopNotifications Methods def :: NotificationConfig #

defaultNotificationConfig :: NotificationConfig Source #

The default formatter is one of * Summary : Body * Summary * (N) Summary : Body * (N) Summary depending on the presence of a notification body, and where N is the number of queued notifications.

notifyAreaNew :: MonadIO m => NotificationConfig -> m Widget Source #

Create a new notification area with the given configuration.