Sha256: 0f01c3d246ed92d82d24e02b9c13b5f8f4bcd1cc225e884793753b59abaf6777

Contents?: true

Size: 1.97 KB

Versions: 27

Compression:

Stored size: 1.97 KB

Contents

# Ruby bindings for libnotify using FFI.
#
# See README.rdoc for usage examples.
#
# @see README.rdoc
# @see Libnotify.new
# @author Peter Suschlik
module Libnotify
  # Creates a notification.
  #
  # @example Block syntax
  #   n = Libnotify.new do |notify|
  #     notify.summary    = "hello"
  #     notify.body       = "world"
  #     notify.timeout    = 1.5         # 1.5 (s), 1000 (ms), "2", nil, false
  #     notify.urgency    = :critical   # :low, :normal, :critical
  #     notify.append     = false       # default true - append onto existing notification
  #     notify.icon_path  = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
  #   end
  #   n.show!
  #
  # @example Hash syntax
  #   Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
  #
  # @example Mixed syntax
  #   Libnotify.new(options) do |n|
  #     n.timeout = 1.5     # overrides :timeout in options
  #     n.show!
  #   end
  #
  # @param [Hash] options  options creating a notification
  # @option options [String] :summary (' ') summary/title of the notification
  # @option options [String] :body (' ') the body
  # @option options [Fixnum, Float, nil, FalseClass, String] :timeout (nil) display duration of the notification.
  #   Use +false+ or +nil+ for no timeout.
  # @option options [Symbol] :urgency (:normal) the urgency of the notification.
  #   Possible values are: +:low+, +:normal+ and +:critical+
  # @option options [String] :icon_path path the an icon displayed.
  #
  # @yield [notify]   passes the notification object
  # @yieldparam [API] notify the notification object
  #
  # @return [API] the notification object
  def self.new(options={}, &block)
    API.new(options, &block)
  end

  # Shows a notification. It takes the same +options+ as Libnotify.new.
  #
  # @see Libnotify.new
  def self.show(options={}, &block)
    API.show(options, &block)
  end

  autoload  :VERSION, 'libnotify/version'
  autoload  :API,     'libnotify/api'
  autoload  :FFI,     'libnotify/ffi'
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
libnotify-0.5.2-universal-rubinius-1.2 lib/libnotify.rb
libnotify-0.5.2-universal-java-1.6 lib/libnotify.rb
libnotify-0.5.2-x86-linux lib/libnotify.rb
libnotify-0.5.1-x86-linux lib/libnotify.rb
libnotify-0.5.1-universal-rubinius-1.2 lib/libnotify.rb
libnotify-0.5.1-universal-java-1.6 lib/libnotify.rb
libnotify-0.5.1 lib/libnotify.rb