Sha256: c3ead6fb809041efa9d82aade1b632793ada0d922aaafda2b507c544642dc2ae

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

module Notifier
  module OsdCat
    extend self

    def supported?
      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}` }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notifier-0.1.3 lib/notifier/osd_cat.rb
notifier-0.1.2 lib/notifier/osd_cat.rb
notifier-0.1.1 lib/notifier/osd_cat.rb