Class: Fusuma::Plugin::Parsers::LibinputGestureParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/fusuma/plugin/parsers/libinput_gesture_parser.rb

Overview

parse libinput and generate gesture record

Constant Summary collapse

DEFAULT_SOURCE =
'libinput_command_input'

Instance Method Summary collapse

Methods inherited from Parser

#parse, #source, #tag

Methods inherited from Base

#config_index, #config_param_types, #config_params, inherited, plugins

Methods included from CustomProcess

#fork

Instance Method Details

#parse_record(record) ⇒ Records::GestureRecord?

Parameters:

Returns:

  • (Records::GestureRecord, nil)


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fusuma/plugin/parsers/libinput_gesture_parser.rb', line 15

def parse_record(record)
  case line = record.to_s
  when /GESTURE_SWIPE|GESTURE_PINCH/
    gesture, status, finger, delta = parse_libinput(line)
  else
    return
  end

  Events::Records::GestureRecord.new(status: status,
                                     gesture: gesture,
                                     finger: finger,
                                     delta: delta)
end