Sha256: 6cf57547ec96e0a3e203d65f2e0f4dd6bb417279f449c5d231781009d36007c8
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
#!/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 = {} opt = OptionParser.new opt.on('-l', '--list-keycodes', 'List available keycodes') do |v| option[:list] = v end opt.on('--version', 'Show version') do |v| 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: device_name).search_codes return end if option[:version] puts Fusuma::Plugin::Sendkey::VERSION return end args = ARGV.first if args.nil? warn 'fusuma-sendkey require 1 arugument' warn 'e.g. fusuma-sendkey LEFTALT+LEFT' warn 'e.g. fusuma-sendkey [A, B, C]' exit 1 end # remove [ and ] from args params = args.delete('[]').split(',').map(&:strip) require 'debug'; debugger keyboard = Fusuma::Plugin::Sendkey::Keyboard.new(name_pattern: device_name) return unless keyboard.valid?(params) if params.size == 1 keyboard.type(param: params.first) else keyboard.types(params) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fusuma-plugin-sendkey-0.11.0 | exe/fusuma-sendkey |