Sha256: c1ef97f8429d290cfe02297a4cd75d9b3758038a41f63b69e4c125a73831c95e

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

require "karabiner/namespace"
require "karabiner/property"
require "karabiner/remap"
require "karabiner/invoke_history"

module Karabiner::DSL::Item
  AVAILABLE_PROPERTIES = %i(
    name
    identifier
    autogen
  ).freeze

  def remap(target, options = {})
    remap = Karabiner::Remap.new(target, options[:to])
    add_child(remap)
  end

  def show_message(message)
    property = Karabiner::Property.new("autogen", "__ShowStatusMessage__ #{message}")
    add_child(property)
  end

  def invoke(application)
    Karabiner::InvokeHistory.register(application)
    "VK_OPEN_URL_APP_#{application.gsub(/ /, '_')}"
  end

  private

  def method_missing(property, value = '', options = {})
    if AVAILABLE_PROPERTIES.include?(property)
      property = Karabiner::Property.new(property, value, options)
      add_child(property)
    else
      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
karabiner-0.1.2 lib/karabiner/dsl/item.rb
karabiner-0.1.1 lib/karabiner/dsl/item.rb
karabiner-0.1.0 lib/karabiner/dsl/item.rb