lib/fusuma/plugin/executors/sendkey_executor.rb in fusuma-plugin-sendkey-0.10.1 vs lib/fusuma/plugin/executors/sendkey_executor.rb in fusuma-plugin-sendkey-0.11.0

- old
+ new

@@ -24,24 +24,33 @@ # fork and execute sendkey command # @param event [Event] # @return [nil] def execute(event) - MultiLogger.info(sendkey: search_param(event)) - keyboard.type( - param: search_param(event), - keep: search_keypress(event), - clear: clearmodifiers(event) - ) + params = search_param(event) + MultiLogger.info(sendkey: params) + case params + when Array + keyboard.types(params) + when String + keyboard.type( + param: params, + keep: search_keypress(event), + clear: clearmodifiers(event) + ) + else + MultiLogger.error("sendkey: Invalid config: #{params}") + nil + end end # check executable # @param event [Event] # @return [TrueClass, FalseClass] def executable?(event) event.tag.end_with?("_detector") && event.record.type == :index && - keyboard.valid?(param: search_param(event)) + keyboard.valid?(search_param(event)) end private def keyboard