class Meshchat::Ui::Notifier::LibNotify
Inherit from base to obtain singletonness
Meshchat
uses singletons for notifications, because an OS generally only has one notification system
Public Instance Methods
show(*args) { |notify| ... }
click to toggle source
this is the only method that needs to be overwritten
# File lib/meshchat/ui/notifier/lib_notify.rb, line 11 def show(*args) libnotify_message.update(*args) do |notify| yield(notify) if block_given? end end
Private Instance Methods
icon_path()
click to toggle source
# File lib/meshchat/ui/notifier/lib_notify.rb, line 19 def icon_path unless @icon_path relative_path = 'vendor/icons/ic_chat_bubble_black_24dp.png' current_directory = Dir.pwd # should be the gem root @icon_path = current_directory + '/' + relative_path end @icon_path end
libnotify_message()
click to toggle source
# File lib/meshchat/ui/notifier/lib_notify.rb, line 29 def libnotify_message @message ||= Libnotify.new do |notify| notify.summary = APP_CONFIG[:client_name] notify.body = '' notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false notify.urgency = :normal # :low, :normal, :critical notify.append = false # default true - append onto existing notification notify.transient = false # default false - keep the notifications around after display # TODO: this will vary on each system - maybe package icons # with the gem notify.icon_path = icon_path end @message end