Class: Fusuma::Plugin::Inputs::RemapTouchpadInput
- Inherits:
-
Input
- Object
- Input
- Fusuma::Plugin::Inputs::RemapTouchpadInput
- Includes:
- CustomProcess
- Defined in:
- lib/fusuma/plugin/inputs/remap_touchpad_input.rb
Overview
Get touchpad events from remapper
Defined Under Namespace
Classes: TouchpadSelector
Instance Method Summary collapse
- #config_param_types ⇒ Object
-
#initialize ⇒ RemapTouchpadInput
constructor
A new instance of RemapTouchpadInput.
- #io ⇒ Object
-
#read_from_io ⇒ Record
override Input#read_from_io.
Constructor Details
#initialize ⇒ RemapTouchpadInput
Returns a new instance of RemapTouchpadInput.
18 19 20 21 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 18 def initialize super setup_remapper end |
Instance Method Details
#config_param_types ⇒ Object
12 13 14 15 16 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 12 def config_param_types { touchpad_name_patterns: [Array, String] } end |
#io ⇒ Object
23 24 25 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 23 def io @fusuma_reader end |
#read_from_io ⇒ Record
override Input#read_from_io
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 29 def read_from_io @unpacker ||= MessagePack::Unpacker.new(io) data = @unpacker.unpack raise "data is not Hash : #{data}" unless data.is_a? Hash gesture = "touch" finger = data["finger"] status = data["status"] Events::Records::GestureRecord.new(gesture: gesture, status: status, finger: finger, delta: nil) rescue EOFError => e MultiLogger.error "#{self.class.name}: #{e}" MultiLogger.error "Shutdown fusuma process..." Process.kill("TERM", Process.pid) end |