module Guard::Notifier::Notifu
def available?(silent = false)
-
(Boolean)
- the availability status
Parameters:
-
silent
(Boolean
) -- true if no error messages should be shown
def available?(silent = false) if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ require 'rb-notifu' true else ::Guard::UI.error 'The :notifu notifier runs only on Windows.' unless silent false end rescue LoadError ::Guard::UI.error "Please add \"gem 'rb-notifu'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent false end
def notifu_type(type)
-
(Symbol)
- the Notify notification type
Parameters:
-
type
(String
) -- the Guard notification type
def notifu_type(type) case type when 'failed' :error when 'pending' :warn else :info end end
def notify(type, title, message, image, options = { })
(**options)
-
xp
(Boolean
) -- use IUserNotification interface event when IUserNotification2 is available -
noquiet
(Boolean
) -- show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up) -
nosound
(Boolean
) -- do not play a sound when the tooltip is displayed -
baloon
(Boolean
) -- enable ballon tips in the registry (for this user only) -
icon
(Boolean
) -- specify an icon to use ("parent" uses the icon of the parent process) -
time
(Number
) -- the number of seconds to display (0 for infinit)
Parameters:
-
options
(Hash
) -- additional notification library options -
image
(String
) -- the path to the notification image -
message
(String
) -- the notification message body -
title
(String
) -- the notification title -
type
(String
) -- the notification type. Either 'success', 'pending', 'failed' or 'notify'
def notify(type, title, message, image, options = { }) require 'rb-notifu' ::Notifu.show(DEFAULTS.merge(options).merge({ :type => notifu_type(type), :title => title, :message => message })) end