Module: Notifier::Hud

Extended by:
Hud
Included in:
Hud
Defined in:
lib/notifier/hud.rb

Instance Method Summary collapse

Instance Method Details

#hud_binObject



11
12
13
14
15
16
# File 'lib/notifier/hud.rb', line 11

def hud_bin
  @hud_bin ||= [
    "/Applications/hud.app/Contents/MacOS/cli",
    "~/Applications/hud.app/Contents/MacOS/cli"
  ].first {|path| File.expand_path(path) }
end

#notify(options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/notifier/hud.rb', line 18

def notify(options)
  command = [
    hud_bin,
    "--title",
    options[:title].to_s,
    "--message",
    options[:message].to_s,
    "--symbol-name",
    options[:image].to_s
  ]

  Thread.new { system(*command) }.join
end

#supported?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/notifier/hud.rb', line 7

def supported?
  Notifier.os?(/darwin/) && hud_bin
end