exe/fusuma-sendkey in fusuma-plugin-sendkey-0.9.0 vs exe/fusuma-sendkey in fusuma-plugin-sendkey-0.10.0
- old
+ new
@@ -1,9 +1,10 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
+require 'fusuma/config'
require 'fusuma/plugin/inputs/libinput_command_input.rb'
require_relative '../lib/fusuma/plugin/sendkey/keyboard.rb'
require_relative '../lib/fusuma/plugin/sendkey/version.rb'
option = {}
@@ -18,12 +19,17 @@
option[:version] = v
end
opt.parse!(ARGV)
+device_name = Fusuma::Config.instance.fetch_config_params(
+ :device_name,
+ Fusuma::Config::Index.new([:plugin, :executors, :sendkey_executor])
+).fetch(:device_name, nil)
+
if option[:list]
- puts Fusuma::Plugin::Sendkey::Keyboard.new(name_pattern: nil).search_codes
+ puts Fusuma::Plugin::Sendkey::Keyboard.new(name_pattern: device_name).search_codes
return
end
if option[:version]
puts Fusuma::Plugin::Sendkey::VERSION
@@ -36,7 +42,7 @@
warn 'fusuma-sendkey require 1 arugument'
warn 'e.g. fusuma-sendkey LEFTALT+LEFT'
exit 1
end
-keyboard = Fusuma::Plugin::Sendkey::Keyboard.new
+keyboard = Fusuma::Plugin::Sendkey::Keyboard.new(name_pattern: device_name)
keyboard.valid?(param: param) && keyboard.type(param: param)