Parent

Files

Guard::Notifier::NotifySend

System notifications using notify-send, a binary that ships with the libnotify-bin package on many Debian-based distributions.

@example Add the `:notifysend` notifier to your `Guardfile`

notification :notifysend

Constants

DEFAULTS

Default options for the notify-send notifications.

SUPPORTED

Full list of options supported by notify-send.

Public Class Methods

available?(opts = {}) click to toggle source
# File lib/guard/notifiers/notifysend.rb, line 27
def self.available?(opts = {})
  super
  _register!(opts)
end
supported_hosts() click to toggle source
# File lib/guard/notifiers/notifysend.rb, line 23
def self.supported_hosts
  ]linux freebsd openbsd sunos solaris]
end

Public Instance Methods

notify(message, opts = {}) click to toggle source

Shows a system notification.

@param [String] message the notification message body @param [Hash] opts additional notification library options @option opts [String] type the notification type. Either 'success',

'pending', 'failed' or 'notify'

@option opts [String] title the notification title @option opts [String] image the path to the notification image @option opts [String] c the notification category @option opts [Number] t the number of milliseconds to display (1000,

3000)
# File lib/guard/notifiers/notifysend.rb, line 44
def notify(message, opts = {})
  normalize_standard_options!(opts)

  command = [title, message]
  opts = DEFAULTS.merge(
    i: opts.delete(:image),
    u: _notifysend_urgency(opts.delete(:type))
  ).merge(opts)

  system('notify-send', *_to_arguments(command, SUPPORTED, opts))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.