Sha256: f8b9e6f1effadacee1f69f3de49cd49f6cf881a58092174082a348cb282176ff

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

module Notifier
  module Knotify
    extend self

    def supported?
      Notifier.os?(/(linux|freebsd)/) &&
        `ps -Al | grep dcop` &&
        $CHILD_STATUS == 0
    end

    def notify(options)
      command = [
        "dcop", "knotify", "default", "notify", "eventname",
        options[:title].to_s, options[:message].to_s,
        "", "", "16", "2"
      ]

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notifier-1.0.0 lib/notifier/knotify.rb