lib/notifier/osd_cat.rb in notifier-0.1.3 vs lib/notifier/osd_cat.rb in notifier-0.1.4

- old
+ new

@@ -6,23 +6,27 @@ RUBY_PLATFORM =~ /(linux|freebsd)/ && `which osd_cat > /dev/null` && $? == 0 end def notify(options) color = options.fetch(:color, "white") - message = options[:message].inspect.gsub(/!/, "\\!") - command = %W[ - echo #{message} | - osd_cat - --shadow=0 - --colour=#{color} - --pos=top - --offset=10 - --align=center - --font=-adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-*-* - --delay=5 - --outline=4 - ].join(" ") - Thread.new { `#{command}` } + command = [ + "osd_cat", + "--shadow", "0", + "--colour", color, + "--pos", "top", + "--offset", "10", + "--align", "center", + "--font", "-bitstream-bitstream charter-bold-r-*-*-*-350-*-*-*-*-*-*", + "--delay", "5", + "--outline", "4", + ] + + Thread.new do + Open3.popen3(*command) do |stdin, stdout, stderr| + stdin.puts options[:message] + stdin.close + end + end end end end