Class: Fusuma::Plugin::Inputs::LibinputCommandInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fusuma/plugin/inputs/libinput_command_input.rb

Overview

libinput commands wrapper

Instance Attribute Summary

Attributes inherited from Input

#tag

Instance Method Summary collapse

Methods inherited from Input

#create_event, #initialize, #read_from_io, select

Methods inherited from Base

#config_index, #config_params, inherited, plugins, #shutdown

Constructor Details

This class inherits a constructor from Fusuma::Plugin::Inputs::Input

Instance Method Details

#commandLibinputCommand

: () -> (Fusuma::LibinputCommand)

Returns:



38
39
40
41
42
43
44
45
46
47
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 38

def command
  @command ||= LibinputCommand.new(
    libinput_options: libinput_options,
    commands: {
      libinput_command: libinput_command,
      debug_events_command: debug_events_command,
      list_devices_command: list_devices_command
    }
  )
end

#config_param_typesObject

: () -> Hash[Symbol, Array]



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 12

def config_param_types
  {
    device: [String],
    "enable-dwt": [TrueClass, FalseClass],
    "disable-dwt": [TrueClass, FalseClass],
    "enable-tap": [TrueClass, FalseClass],
    "show-keycodes": [TrueClass, FalseClass],
    verbose: [TrueClass, FalseClass],
    "libinput-command": [String],
    "libinput-debug-events": [String],
    "libinput-list-devices": [String]
  }
end

#debug_events_commandObject

: () -> String?



74
75
76
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 74

def debug_events_command # steep:ignore MethodBodyTypeMismatch
  config_params(:"libinput-debug-events")
end

#ioIO

: () -> StringIO

Returns:

  • (IO)


28
29
30
31
32
33
34
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 28

def io
  @io ||= begin
    reader, writer = create_io
    command.debug_events(writer)
    reader
  end
end

#libinput_commandObject

: () -> String?



69
70
71
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 69

def libinput_command # steep:ignore MethodBodyTypeMismatch
  config_params(:"libinput-command")
end

#libinput_optionsArray

: () -> Array

Returns:

  • (Array)


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 51

def libinput_options
  device = ("--device='#{config_params(:device)}'" if config_params(:device))
  enable_tap = "--enable-tap" if config_params(:"enable-tap")
  enable_dwt = "--enable-dwt" if config_params(:"enable-dwt")
  disable_dwt = "--disable-dwt" if config_params(:"disable-dwt")
  show_keycodes = "--show-keycodes" if config_params(:"show-keycodes")
  verbose = "--verbose" if config_params(:verbose)
  [
    device,
    enable_tap,
    enable_dwt,
    disable_dwt,
    show_keycodes,
    verbose
  ].compact
end

#list_devices_commandObject

: () -> String?



79
80
81
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 79

def list_devices_command # steep:ignore MethodBodyTypeMismatch
  config_params(:"libinput-list-devices")
end