11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/notifier/terminal_notifier.rb', line 11
def notify(options)
command = [
"terminal-notifier",
"-ignoreDnD",
"-group", "notifier-rubygems",
"-title", options[:title].to_s,
"-message", options[:message].to_s,
"-subtitle", options.fetch(:subtitle, "").to_s
]
if options[:sound]
command.push("-sound", options.fetch(:sound, "default").to_s)
end
Thread.new do
Open3.popen3(*command) do |_stdin, _stdout, _stderr|
end
sleep 5
Open3.popen3("terminal-notifier", "-remove", "notifier-rubygems")
end.join
end
|