Sha256: 00e6e2d2386850bf52bcee1c0558f799ff41d878e933f96156241bbc85245ec3

Contents?: true

Size: 715 Bytes

Versions: 3

Compression:

Stored size: 715 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")

      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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notifier-0.2.0 lib/notifier/osd_cat.rb
notifier-0.1.5 lib/notifier/osd_cat.rb
notifier-0.1.4 lib/notifier/osd_cat.rb