Sha256: bd71e304363731c3ef86af7afd997de7644a5f8227af6490d2e23a65a68f2a76
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true require_relative '../sendkey/keyboard.rb' module Fusuma module Plugin module Executors # Control Window or Workspaces by executing wctrl class SendkeyExecutor < Executor # execute sendkey command # @param event [Event] # @return [nil] def execute(event) return if search_command(event).nil? MultiLogger.info(sendkey: search_param(event)) pid = fork do Process.daemon(true) exec(search_command(event)) end Process.detach(pid) end # check executable # @param event [Event] # @return [TrueClass, FalseClass] def executable?(event) event.tag.end_with?('_detector') && event.record.type == :index && search_command(event) end # @param event [Event] # @return [String] # @return [NilClass] def search_command(event) @keyboard ||= Keyboard.new @keyboard.type_command(param: search_param(event)) end private def search_param(event) index = Config::Index.new([*event.record.index.keys, :sendkey]) Config.search(index) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fusuma-plugin-sendkey-0.1.0 | lib/fusuma/plugin/executors/sendkey_executor.rb |