Sha256: 3a600029dda51a60a448257f6f832a44b454c2980b7dde9bf744c387b0ca90ef

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

module TestNotifier
  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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_notifier-0.3.4 lib/test_notifier/notifier/osd_cat.rb