package obus

  1. Overview
  2. Docs
Pure Ocaml implementation of the D-Bus protocol

Install

Dune Dependency

Authors

Maintainers

Sources

obus-1.2.5.tar.gz
md5=81eb1034c6ef4421a2368a9b352199de
sha512=4b540497188a7d78f4f14f94c6b7fdff47dd06436a34e650ff378dd77bb3e2acb7afd45cd72daf4ddba06e732e9944d560c2882dc37862f1b1f1bb6df37e6205

doc/obus.notification/Notification/index.html

Module NotificationSource

Popup notifications

For complete details about notifications, look at the the official specifications

Sourceval app_name : string ref

Application name used for notification. The default value is taken from Sys.argv.(0)

Sourceval desktop_entry : string option ref

If the application has a desktop entry, it can be specified here

Operations on notifications
Sourcetype 'a t

Type of an opened notifications

Sourceval result : 'a t -> 'a Lwt.t

Waits for a notification to be closed then returns:

  • `Closed if the user clicked on the cross, timeout was reached or the notification daemon exited
  • `Default if the default action was invoked, i.e. the user clicked on the notification, but not on a buttons
  • the corresponding action if the user clicked on a button other than the cross
Sourceval close : 'a t -> unit Lwt.t

Close the notification now

Opening notifications
Sourcetype urgency = [
  1. | `Low
  2. | `Normal
  3. | `Critical
]

Urgency level of popups

Sourcetype image = {
  1. img_width : int;
  2. img_height : int;
  3. img_rowstride : int;
  4. img_has_alpha : bool;
  5. img_bits_per_sample : int;
  6. img_channels : int;
  7. img_data : string;
}

An image description

Sourceval notify : ?app_name:string -> ?desktop_entry:string -> ?replace:_ t -> ?icon:string -> ?image:image -> summary:string -> ?body:string -> ?actions:(string * [> `Default | `Closed ] as 'a) list -> ?urgency:urgency -> ?category:string -> ?sound_file:string -> ?suppress_sound:bool -> ?pos:(int * int) -> ?hints:(string * OBus_value.V.single) list -> ?timeout:int -> unit -> 'a t Lwt.t

Open a notification.

  • app_name and desktop_entry can override default values taken from references
  • replace is a popup id this notification replace
  • icon is the notification icon. It is either as a URI (file://...) or a name in a freedesktop.org-compliant icon theme (not a GTK+ stock ID)
  • image is an image, it is used if icon is not present
  • summary is a single line overview of the notification
  • body is a multi-line body of text. Each line is a paragraph, server implementations are free to word wrap them as they see fit. The body may contain simple markup as specified in Markup. It must be encoded using UTF-8. If the body is omitted, just the summary is displayed.
  • action is a list of (text, key) pair, text is the text displayed to the user and key is the value which will be returned when the action is invoked
  • category is a string representing the category of the notification, for example: "device.added", "email.arrived" (more category can be found in the specifications)
  • sound_file is a sound file to play while displaying the notification
  • suppress_sound tell the daemon to suppress sounds
  • pos is a screen position
  • hints is a list of additionnal hints
  • timeout is a timeout in millisecond
Informations
Sourcetype server_info = {
  1. server_name : string;
  2. server_vendor : string;
  3. server_version : string;
  4. server_spec_version : string;
}

Server informations

Sourceval get_server_information : unit -> server_info Lwt.t

Retreive server informations

Sourceval get_capabilities : unit -> string list Lwt.t

Retreive server capabilities, see specification for details

OCaml

Innovation. Community. Security.