Module: Autotestforphp::Notification::Linux
- Defined in:
- lib/autotestforphp/notification/linux.rb
Class Method Summary collapse
- .has_kdialog? ⇒ Boolean
- .has_notify? ⇒ Boolean
- .has_zenity? ⇒ Boolean
- .kdialog(title, msg, img) ⇒ Object
- .notify(title, msg, img) ⇒ Object
- .notify_send(title, msg, img) ⇒ Object
- .zenity(title, msg, img) ⇒ Object
Class Method Details
.has_kdialog? ⇒ Boolean
20 21 22 |
# File 'lib/autotestforphp/notification/linux.rb', line 20 def has_kdialog? system "which kdialog > /dev/null 2>&1" end |
.has_notify? ⇒ Boolean
16 17 18 |
# File 'lib/autotestforphp/notification/linux.rb', line 16 def has_notify? system "which notify-send > /dev/null 2>&1" end |
.has_zenity? ⇒ Boolean
24 25 26 |
# File 'lib/autotestforphp/notification/linux.rb', line 24 def has_zenity? system "which zenity > /dev/null 2>&1" end |
.kdialog(title, msg, img) ⇒ Object
32 33 34 |
# File 'lib/autotestforphp/notification/linux.rb', line 32 def kdialog(title, msg, img) system "kdialog --title '#{title}' --passivepopup '<img src=\"#{img}\" align=\"middle\"> #{msg}'" end |
.notify(title, msg, img) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/autotestforphp/notification/linux.rb', line 6 def notify(title, msg, img) if has_notify? notify_send(title, msg, img) elsif has_zenity? zenity(title, msg, img) elsif has_kdialog? kdialog(title, msg, img) end end |
.notify_send(title, msg, img) ⇒ Object
28 29 30 |
# File 'lib/autotestforphp/notification/linux.rb', line 28 def notify_send(title, msg, img) system "notify-send -i #{img} '#{title}' '#{msg}'" end |
.zenity(title, msg, img) ⇒ Object
36 37 38 |
# File 'lib/autotestforphp/notification/linux.rb', line 36 def zenity(title, msg, img) system "zenity --info --text='#{msg}' --title='#{title}'" end |