Permalink
Browse files

Fixed osd_cat command; color was being set through options[:status], …

…which doesn't exist in this context.
  • Loading branch information...
1 parent ef76f21 commit 28fb40887b31ef8f5a52165b057a05cadfd017c6 @fnando committed Nov 19, 2010
Showing with 17 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +16 −13 lib/notifier/osd_cat.rb
View
@@ -1,3 +1,4 @@
pkg/*
*.gem
.bundle
+.DS_Store
@@ -2,24 +2,27 @@ module Notifier
module OsdCat
extend self
- FONT = "-bitstream-charter-bold-r-normal--33-240-100-100-p-206-iso8859-1"
- POSITION = "top"
- POSITION_OFFSET = "0"
- ALIGN = "center"
- COLORS = {
- :fail => "orange",
- :success => "green",
- :error => "red"
- }
-
def supported?
RUBY_PLATFORM =~ /(linux|freebsd)/ && `which osd_cat > /dev/null` && $? == 0
end
def notify(options)
- Thread.new do
- `echo #{options[:message].inspect} | osd_cat --font=#{FONT} --shadow=0 --pos=#{POSITION} -o #{POSITION_OFFSET} --delay=4 --outline=4 --align=#{ALIGN} -c #{COLORS[options[:status]]}`
- end
+ 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}` }
end
end
end

0 comments on commit 28fb408

Please sign in to comment.