Sha256: f6abbb66dba304c474018f9e6a3318dc16478f96d48fadb80dd766d6a062c20c

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

module AutotestNotification
  class Linux
    class << self
      def notify(title, msg, img)
        if has_notify?
          notify_send(title, msg, img)
        else
          kdialog(title, msg, img)
        end
      end

      protected
        def notify_send(title, msg, img)
          system "notify-send -t #{EXPIRATION_IN_SECONDS * 1000} -i #{img} '#{title}' '#{msg}'"
        end

        def kdialog(title, msg, img)
          system "kdialog --title '#{title}' --passivepopup '#{msg}' #{EXPIRATION_IN_SECONDS}"
        end

        def has_notify?
          system "which notify-send 2> /dev/null"
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
carlosbrando-autotest-notification-0.1.0 lib/autotest_notification/linux.rb
urubatan-autotest-notification-0.1.0 lib/autotest_notification/linux.rb