Class: Fusuma::Plugin::Inputs::LibinputCommandInput
- Inherits:
-
Input
- Object
- Base
- Input
- Fusuma::Plugin::Inputs::LibinputCommandInput
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
Instance Method Details
34
35
36
37
38
39
40
41
42
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 34
def command
@command ||= LibinputCommand.new(
libinput_options: libinput_options,
commands: {
debug_events_command: debug_events_command,
list_devices_command: list_devices_command
}
)
end
|
#config_param_types ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 11
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-debug-events": [String],
"libinput-list-devices": [String]
}
end
|
#debug_events_command ⇒ Object
62
63
64
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 62
def debug_events_command
config_params(:"libinput-debug-events")
end
|
#io ⇒ IO
25
26
27
28
29
30
31
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 25
def io
@io ||= begin
reader, writer = create_io
command.debug_events(writer)
reader
end
end
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 45
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_command ⇒ Object
66
67
68
|
# File 'lib/fusuma/plugin/inputs/libinput_command_input.rb', line 66
def list_devices_command
config_params(:"libinput-list-devices")
end
|