Sha256: f99869245e5a87590e07e179385f460b6cf67cf1b90e7c4b364b6d6fd61ed2a3

Contents?: true

Size: 712 Bytes

Versions: 4

Compression:

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

      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

4 entries across 4 versions & 1 rubygems

Version Path
notifier-0.5.0 lib/notifier/osd_cat.rb
notifier-0.4.1 lib/notifier/osd_cat.rb
notifier-0.4.0 lib/notifier/osd_cat.rb
notifier-0.2.1 lib/notifier/osd_cat.rb