Sha256: d46bc6129a48381d5ca4f7662c368f68d34fe361d53458605a29c5a336985e71

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notifier-0.1.0 lib/notifier/osd_cat.rb