Sha256: 9cca6a594a03a7cfad76861aa854e3db83c2a469a38f8be0bc9671cf91932916

Contents?: true

Size: 735 Bytes

Versions: 5

Compression:

Stored size: 735 Bytes

Contents

# Notifies via libnotify.
module RiotNotifier

  class Libnotify < Base
    OPTIONS = {
      :green => {
        :icon_path => "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg",
        :timeout => 2.5,
        :urgency => :normal,
        :summary => ":-)"
      },
      :red => {
        :icon_path => "/usr/share/icons/gnome/scalable/emotes/face-angry.svg",
        :timeout => 2.5,
        :urgency => :critical,
        :summary => ":-("
      }
    }

    def notify(color, msg)
      options = OPTIONS[color] or raise "unknown color #{color}"

      ::Libnotify.show(options.merge(:body => msg))
    end

    def self.usable?
      require 'libnotify'
      true
    rescue LoadError
      false
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riot_notifier-0.3.0 lib/riot_notifier/libnotify.rb
riot_notifier-0.2.0 lib/riot_notifier/libnotify.rb
riot_notifier-0.1.1 lib/riot_notifier/libnotify.rb
riot_notifier-0.0.8 lib/riot_notifier/libnotify.rb
riot_notifier-0.0.7 lib/riot_notifier/libnotify.rb