class Notify

Overview

Notify is a Crystal library for Desktop Notifications compatible notification systems. It uses DBus internally to connect to the user's notification daemon.

Defined in:

notify/version.cr
notify.cr

Constant Summary

VERSION = "0.1.0"

Constructors

Instance Method Summary

Constructor Detail

def self.new #

Creates a new instance of Notify.


[View source]

Instance Method Detail

def capabilities : Array(String) #

An array of strings indicating the capabilities of this notification daemon.


[View source]
def capability?(feature : String) #

Checks whether the user's notification daemon supports feature.

The list of currently standardized features can be found here: <http://www.galago-project.org/specs/notification/0.9/x408.html#command-get-capabilities>

n.capability?("body") # => true

[View source]
def close(id : UInt32) #

Closes the open notification whose identifier is id, or does nothing if that notification is already closed.

n.close(1337)

[View source]
def information : Array(String) #

An array of strings indicating the version and vendor of this notification daemon.


[View source]
def notify(summary, app_name = "", replaces_id = 0_u32, app_icon = "", body = "", actions = [] of String, hints = {} of String => DBus::Variant, expire_timeout = -1) #

Creates a new notification. summary is the only required parameter.

See <http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify> for information on optional parameters.

Returns a notification ID that can be used with #close or as replaces_id in subsequent calls to #notify.

n.notify "hello", body: "<b>world!</b>" # => 1337

[View source]