Sha256: 0121c78418a1d603a8566d85cffdad3abab58c65b3e179690f0b87d5f997cbed

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

module Notifier
  module OsdCat
    extend self

    def supported?
      Notifier.os?(/(linux|freebsd)/) && `which osd_cat > /dev/null` && $? == 0
    end

    def notify(options)
      color = options.fetch(:color, "white").to_s

      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.join
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notifier-0.5.2 lib/notifier/osd_cat.rb
notifier-0.5.1 lib/notifier/osd_cat.rb