lib/fusuma/plugin/parsers/keypress_parser.rb in fusuma-plugin-keypress-0.4.2 vs lib/fusuma/plugin/parsers/keypress_parser.rb in fusuma-plugin-keypress-0.5.0
- old
+ new
@@ -5,22 +5,10 @@
module Parsers
# Generate KeypressRecord from libinput_command_input
class KeypressParser < Parser
DEFAULT_SOURCE = 'libinput_command_input'
- AVAILABLE_KEYS = %w[
- CAPSLOCK
- LEFTALT
- LEFTCTRL
- LEFTMETA
- LEFTSHIFT
- RIGHTALT
- RIGHTCTRL
- RIGHTSHIFT
- RIGHTMETA
- ].freeze
-
# @param record [String]
# @return [Records::Gesture, nil]
def parse_record(record)
line = record.to_s
@@ -36,11 +24,9 @@
when /KEYBOARD_KEY.+(\d+\.\d+)s.*KEY_([A-Z]+).*(pressed|released)/
matched = Regexp.last_match
# time = matched[1] # 4.81
code = matched[2] # LEFTSHIFT
status = matched[3] # pressed
-
- return unless AVAILABLE_KEYS.include?(code)
Events::Records::KeypressRecord.new(status: status, code: code)
end
end