Sha256: 6fe9c6fad94d0ad0d7cd54f91826ba501e70aec85e07b9f0ca2bceb5f317d008
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# Notifies via libnotify. module RiotNotifier class Libnotify < Base ICON = { :green => %w[ /usr/share/icons/gnome/scalable/emblems/emblem-default.svg /usr/share/icons/gnome/256x256/emotes/face-laugh.png ], :red => %w[ /usr/share/icons/gnome/scalable/emotes/face-angry.svg /usr/share/icons/gnome/256x256/emotes/face-angry.png ] } OPTIONS = { :green => { :icon_path => ICON[:green].find { |path| File.exist?(path) }, :timeout => 2.5, :urgency => :normal, :summary => ":-)" }, :red => { :icon_path => ICON[:red].find { |path| File.exist?(path) }, :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riot_notifier-0.4.0 | lib/riot_notifier/libnotify.rb |