Sha256: b94168f8ae0b241854fea808b3e2180be3452b718d3e11a505b1ef34dce3d969

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 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

3 entries across 3 versions & 1 rubygems

Version Path
notifier-1.2.2 lib/notifier/knotify.rb
notifier-1.2.1 lib/notifier/knotify.rb
notifier-1.1.0 lib/notifier/knotify.rb