Sha256: ac4a33762cb83eec4452de4d62d64e87b719585853d17a98f36a9737619cde08

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

# Provides a method for popup notifications using osd_cat
# Extracted from http://theadmin.org/articles/2008/2/10/fail-loudly-with-osd_cat-and-autotest
module OsdCat
  # Use xlsfonts to find the different fonts
  FONT = "-bitstream-charter-bold-r-normal--33-240-100-100-p-206-iso8859-1"

  # Will display the message on the top of the screen centered, adjust these numbers to suit.
  POSITION = "top"             # top|middle|bottom
  POSITION_OFFSET = "0"         # Pixels from position to display (think CSS margin)
  ALIGN = "center"             # left|right|center

  def self.send message, color='green'
    osd_command = "echo #{message.inspect} | osd_cat --font=#{FONT} --shadow=0 --pos=#{POSITION} -o #{POSITION_OFFSET} --delay=4 --outline=4 --align=#{ALIGN} -c #{color}"

    # osd_cat blocks so start a new thread, otherwise Autotest will wait
    Thread.new do
      `#{osd_command}`
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
test_notifier-0.1.4 lib/test_notifier/osd_cat.rb
test_notifier-0.1.3 lib/test_notifier/osd_cat.rb