Sha256: 0e1e1879bd196d5fe471a35942775d11fb289bac292c4097a902c851d8cc904f

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

module Notifier
  module Hud
    extend self

    def supported?
      Notifier.os?(/darwin/) && hud_bin
    end

    def hud_bin
      @hud_bin ||= [
        "/Applications/hud.app/Contents/MacOS/cli",
        "~/Applications/hud.app/Contents/MacOS/cli"
      ].first {|path| File.expand_path(path) }
    end

    def notify(options)
      command = [
        hud_bin,
        "--title",
        options[:title].to_s,
        "--message",
        options[:message].to_s,
        "--symbol-name",
        options[:image].to_s
      ]

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notifier-1.2.2 lib/notifier/hud.rb
notifier-1.2.1 lib/notifier/hud.rb