Module: OsdCat

Defined in:
lib/test_notifier.rb

Overview

Provides a method for popup notifications using osd_cat Extracted from theadmin.org/articles/2008/2/10/fail-loudly-with-osd_cat-and-autotest

Constant Summary collapse

FONT =

Use xlsfonts to find the different fonts

"-bitstream-charter-bold-r-normal--33-240-100-100-p-206-iso8859-1"
POSITION =

Will display the message on the top of the screen centered, adjust these numbers to suit.

"top"
POSITION_OFFSET =

top|middle|bottom

"0"
ALIGN =

Pixels from position to display (think CSS margin)

"center"

Class Method Summary collapse

Class Method Details

.send(msg, color = 'green') ⇒ Object

left|right|center



135
136
137
138
139
140
141
142
# File 'lib/test_notifier.rb', line 135

def self.send msg, color='green'
  osd_command = "echo #{msg.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