Sha256: 059dfc4ea8b92002badab33511b290ae58f01eafb2455dc6936f305b54d42227

Contents?: true

Size: 455 Bytes

Versions: 4

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true

module Notifier
  module NotifySend
    extend self

    def supported?
      Notifier.os?(/(linux|freebsd)/) &&
        `which notify-send > /dev/null` &&
        $CHILD_STATUS == 0
    end

    def notify(options)
      command = [
        "notify-send", "-i",
        options[:image].to_s,
        options[:title].to_s,
        options[:message].to_s
      ]

      Thread.new { system(*command) }.join
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
notifier-1.2.2 lib/notifier/notify_send.rb
notifier-1.2.1 lib/notifier/notify_send.rb
notifier-1.1.0 lib/notifier/notify_send.rb
notifier-1.0.0 lib/notifier/notify_send.rb