fusuma 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fusuma/plugin/manager.rb +3 -3
  3. data/lib/fusuma/version.rb +1 -1
  4. data/spec/helpers/config_helper.rb +20 -0
  5. data/spec/lib/config/searcher_spec.rb +97 -0
  6. data/spec/lib/config_spec.rb +112 -0
  7. data/spec/lib/custom_process_spec.rb +28 -0
  8. data/spec/lib/device_spec.rb +98 -0
  9. data/spec/lib/dummy_config.yml +31 -0
  10. data/spec/lib/fusuma_spec.rb +103 -0
  11. data/spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt +181 -0
  12. data/spec/lib/libinput-list-devices_magic_trackpad.txt +51 -0
  13. data/spec/lib/libinput-list-devices_razer_razer_blade.txt +252 -0
  14. data/spec/lib/libinput-list-devices_thejinx0r.txt +361 -0
  15. data/spec/lib/libinput-list-devices_unavailable.txt +36 -0
  16. data/spec/lib/libinput_command_spec.rb +167 -0
  17. data/spec/lib/plugin/base_spec.rb +74 -0
  18. data/spec/lib/plugin/buffers/buffer_spec.rb +80 -0
  19. data/spec/lib/plugin/buffers/dummy_buffer.rb +20 -0
  20. data/spec/lib/plugin/buffers/gesture_buffer_spec.rb +172 -0
  21. data/spec/lib/plugin/detectors/detector_spec.rb +43 -0
  22. data/spec/lib/plugin/detectors/dummy_detector.rb +24 -0
  23. data/spec/lib/plugin/detectors/pinch_detector_spec.rb +119 -0
  24. data/spec/lib/plugin/detectors/rotate_detector_spec.rb +125 -0
  25. data/spec/lib/plugin/detectors/swipe_detector_spec.rb +118 -0
  26. data/spec/lib/plugin/events/event_spec.rb +30 -0
  27. data/spec/lib/plugin/events/records/gesture_record_spec.rb +22 -0
  28. data/spec/lib/plugin/events/records/record_spec.rb +31 -0
  29. data/spec/lib/plugin/events/records/text_record_spec.rb +26 -0
  30. data/spec/lib/plugin/executors/command_executor_spec.rb +57 -0
  31. data/spec/lib/plugin/executors/executor_spec.rb +160 -0
  32. data/spec/lib/plugin/filters/filter_spec.rb +92 -0
  33. data/spec/lib/plugin/filters/libinput_filter_spec.rb +120 -0
  34. data/spec/lib/plugin/inputs/input_spec.rb +70 -0
  35. data/spec/lib/plugin/inputs/libinput_command_input_spec.rb +120 -0
  36. data/spec/lib/plugin/inputs/timer_input_spec.rb +40 -0
  37. data/spec/lib/plugin/manager_spec.rb +27 -0
  38. data/spec/lib/plugin/parsers/parser_spec.rb +45 -0
  39. data/spec/spec_helper.rb +20 -0
  40. metadata +74 -20
  41. data/.github/FUNDING.yml +0 -8
  42. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
  43. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  44. data/.github/pull_request_template.md +0 -9
  45. data/.github/stale.yml +0 -18
  46. data/.gitignore +0 -17
  47. data/.reek.yml +0 -96
  48. data/.rspec +0 -2
  49. data/.rubocop.yml +0 -43
  50. data/.rubocop_todo.yml +0 -55
  51. data/.solargraph.yml +0 -16
  52. data/.travis.yml +0 -9
  53. data/CHANGELOG.md +0 -456
  54. data/CODE_OF_CONDUCT.md +0 -74
  55. data/CONTRIBUTING.md +0 -72
  56. data/Gemfile +0 -23
  57. data/Rakefile +0 -15
  58. data/fusuma.gemspec +0 -29
@@ -0,0 +1,361 @@
1
+ event7 - HTX USB HID Device HTX HID Device Touchpad: kernel bug: clickpad advertising right button
2
+ Device: Power Button
3
+ Kernel: /dev/input/event1
4
+ Group: 1
5
+ Seat: seat0, default
6
+ Capabilities: keyboard
7
+ Tap-to-click: n/a
8
+ Tap-and-drag: n/a
9
+ Tap drag lock: n/a
10
+ Left-handed: n/a
11
+ Nat.scrolling: n/a
12
+ Middle emulation: n/a
13
+ Calibration: n/a
14
+ Scroll methods: none
15
+ Click methods: none
16
+ Disable-w-typing: n/a
17
+ Accel profiles: n/a
18
+ Rotation: n/a
19
+
20
+ Device: HTX USB HID Device HTX HID Device Keyboard
21
+ Kernel: /dev/input/event4
22
+ Group: 2
23
+ Seat: seat0, default
24
+ Capabilities: keyboard
25
+ Tap-to-click: n/a
26
+ Tap-and-drag: n/a
27
+ Tap drag lock: n/a
28
+ Left-handed: n/a
29
+ Nat.scrolling: n/a
30
+ Middle emulation: n/a
31
+ Calibration: n/a
32
+ Scroll methods: none
33
+ Click methods: none
34
+ Disable-w-typing: n/a
35
+ Accel profiles: n/a
36
+ Rotation: n/a
37
+
38
+ Device: HTX USB HID Device HTX HID Device Consumer Control
39
+ Kernel: /dev/input/event5
40
+ Group: 2
41
+ Seat: seat0, default
42
+ Capabilities: keyboard pointer
43
+ Tap-to-click: n/a
44
+ Tap-and-drag: n/a
45
+ Tap drag lock: n/a
46
+ Left-handed: n/a
47
+ Nat.scrolling: disabled
48
+ Middle emulation: n/a
49
+ Calibration: n/a
50
+ Scroll methods: none
51
+ Click methods: none
52
+ Disable-w-typing: n/a
53
+ Accel profiles: n/a
54
+ Rotation: n/a
55
+
56
+ Device: HTX USB HID Device HTX HID Device Touchpad
57
+ Kernel: /dev/input/event7
58
+ Group: 2
59
+ Seat: seat0, default
60
+ Size: 114x86mm
61
+ Capabilities: pointer gesture
62
+ Tap-to-click: disabled
63
+ Tap-and-drag: enabled
64
+ Tap drag lock: disabled
65
+ Left-handed: disabled
66
+ Nat.scrolling: disabled
67
+ Middle emulation: disabled
68
+ Calibration: n/a
69
+ Scroll methods: *two-finger edge
70
+ Click methods: *button-areas clickfinger
71
+ Disable-w-typing: enabled
72
+ Accel profiles: none
73
+ Rotation: n/a
74
+
75
+ Device: SINO WEALTH Gaming KB
76
+ Kernel: /dev/input/event9
77
+ Group: 3
78
+ Seat: seat0, default
79
+ Capabilities: keyboard
80
+ Tap-to-click: n/a
81
+ Tap-and-drag: n/a
82
+ Tap drag lock: n/a
83
+ Left-handed: n/a
84
+ Nat.scrolling: n/a
85
+ Middle emulation: n/a
86
+ Calibration: n/a
87
+ Scroll methods: none
88
+ Click methods: none
89
+ Disable-w-typing: n/a
90
+ Accel profiles: n/a
91
+ Rotation: n/a
92
+
93
+ Device: SINO WEALTH Gaming KB System Control
94
+ Kernel: /dev/input/event10
95
+ Group: 3
96
+ Seat: seat0, default
97
+ Capabilities: keyboard
98
+ Tap-to-click: n/a
99
+ Tap-and-drag: n/a
100
+ Tap drag lock: n/a
101
+ Left-handed: n/a
102
+ Nat.scrolling: n/a
103
+ Middle emulation: n/a
104
+ Calibration: n/a
105
+ Scroll methods: none
106
+ Click methods: none
107
+ Disable-w-typing: n/a
108
+ Accel profiles: n/a
109
+ Rotation: n/a
110
+
111
+ Device: SINO WEALTH Gaming KB Consumer Control
112
+ Kernel: /dev/input/event11
113
+ Group: 3
114
+ Seat: seat0, default
115
+ Capabilities: keyboard pointer
116
+ Tap-to-click: n/a
117
+ Tap-and-drag: n/a
118
+ Tap drag lock: n/a
119
+ Left-handed: n/a
120
+ Nat.scrolling: disabled
121
+ Middle emulation: n/a
122
+ Calibration: n/a
123
+ Scroll methods: none
124
+ Click methods: none
125
+ Disable-w-typing: n/a
126
+ Accel profiles: n/a
127
+ Rotation: n/a
128
+
129
+ Device: SINO WEALTH Gaming KB Keyboard
130
+ Kernel: /dev/input/event12
131
+ Group: 3
132
+ Seat: seat0, default
133
+ Capabilities: keyboard
134
+ Tap-to-click: n/a
135
+ Tap-and-drag: n/a
136
+ Tap drag lock: n/a
137
+ Left-handed: n/a
138
+ Nat.scrolling: n/a
139
+ Middle emulation: n/a
140
+ Calibration: n/a
141
+ Scroll methods: none
142
+ Click methods: none
143
+ Disable-w-typing: n/a
144
+ Accel profiles: n/a
145
+ Rotation: n/a
146
+
147
+ Device: Yubico YubiKey OTP+FIDO+CCID
148
+ Kernel: /dev/input/event6
149
+ Group: 4
150
+ Seat: seat0, default
151
+ Capabilities: keyboard
152
+ Tap-to-click: n/a
153
+ Tap-and-drag: n/a
154
+ Tap drag lock: n/a
155
+ Left-handed: n/a
156
+ Nat.scrolling: n/a
157
+ Middle emulation: n/a
158
+ Calibration: n/a
159
+ Scroll methods: none
160
+ Click methods: none
161
+ Disable-w-typing: n/a
162
+ Accel profiles: n/a
163
+ Rotation: n/a
164
+
165
+ Device: HDA NVidia HDMI/DP,pcm=3
166
+ Kernel: /dev/input/event13
167
+ Group: 5
168
+ Seat: seat0, default
169
+ Capabilities:
170
+ Tap-to-click: n/a
171
+ Tap-and-drag: n/a
172
+ Tap drag lock: n/a
173
+ Left-handed: n/a
174
+ Nat.scrolling: n/a
175
+ Middle emulation: n/a
176
+ Calibration: n/a
177
+ Scroll methods: none
178
+ Click methods: none
179
+ Disable-w-typing: n/a
180
+ Accel profiles: n/a
181
+ Rotation: n/a
182
+
183
+ Device: HDA NVidia HDMI/DP,pcm=7
184
+ Kernel: /dev/input/event14
185
+ Group: 5
186
+ Seat: seat0, default
187
+ Capabilities:
188
+ Tap-to-click: n/a
189
+ Tap-and-drag: n/a
190
+ Tap drag lock: n/a
191
+ Left-handed: n/a
192
+ Nat.scrolling: n/a
193
+ Middle emulation: n/a
194
+ Calibration: n/a
195
+ Scroll methods: none
196
+ Click methods: none
197
+ Disable-w-typing: n/a
198
+ Accel profiles: n/a
199
+ Rotation: n/a
200
+
201
+ Device: HDA NVidia HDMI/DP,pcm=8
202
+ Kernel: /dev/input/event15
203
+ Group: 5
204
+ Seat: seat0, default
205
+ Capabilities:
206
+ Tap-to-click: n/a
207
+ Tap-and-drag: n/a
208
+ Tap drag lock: n/a
209
+ Left-handed: n/a
210
+ Nat.scrolling: n/a
211
+ Middle emulation: n/a
212
+ Calibration: n/a
213
+ Scroll methods: none
214
+ Click methods: none
215
+ Disable-w-typing: n/a
216
+ Accel profiles: n/a
217
+ Rotation: n/a
218
+
219
+ Device: HDA NVidia HDMI/DP,pcm=9
220
+ Kernel: /dev/input/event16
221
+ Group: 5
222
+ Seat: seat0, default
223
+ Capabilities:
224
+ Tap-to-click: n/a
225
+ Tap-and-drag: n/a
226
+ Tap drag lock: n/a
227
+ Left-handed: n/a
228
+ Nat.scrolling: n/a
229
+ Middle emulation: n/a
230
+ Calibration: n/a
231
+ Scroll methods: none
232
+ Click methods: none
233
+ Disable-w-typing: n/a
234
+ Accel profiles: n/a
235
+ Rotation: n/a
236
+
237
+ Device: HDA NVidia HDMI/DP,pcm=3
238
+ Kernel: /dev/input/event17
239
+ Group: 5
240
+ Seat: seat0, default
241
+ Capabilities:
242
+ Tap-to-click: n/a
243
+ Tap-and-drag: n/a
244
+ Tap drag lock: n/a
245
+ Left-handed: n/a
246
+ Nat.scrolling: n/a
247
+ Middle emulation: n/a
248
+ Calibration: n/a
249
+ Scroll methods: none
250
+ Click methods: none
251
+ Disable-w-typing: n/a
252
+ Accel profiles: n/a
253
+ Rotation: n/a
254
+
255
+ Device: HDA NVidia HDMI/DP,pcm=7
256
+ Kernel: /dev/input/event18
257
+ Group: 5
258
+ Seat: seat0, default
259
+ Capabilities:
260
+ Tap-to-click: n/a
261
+ Tap-and-drag: n/a
262
+ Tap drag lock: n/a
263
+ Left-handed: n/a
264
+ Nat.scrolling: n/a
265
+ Middle emulation: n/a
266
+ Calibration: n/a
267
+ Scroll methods: none
268
+ Click methods: none
269
+ Disable-w-typing: n/a
270
+ Accel profiles: n/a
271
+ Rotation: n/a
272
+
273
+ Device: HDA NVidia HDMI/DP,pcm=8
274
+ Kernel: /dev/input/event19
275
+ Group: 5
276
+ Seat: seat0, default
277
+ Capabilities:
278
+ Tap-to-click: n/a
279
+ Tap-and-drag: n/a
280
+ Tap drag lock: n/a
281
+ Left-handed: n/a
282
+ Nat.scrolling: n/a
283
+ Middle emulation: n/a
284
+ Calibration: n/a
285
+ Scroll methods: none
286
+ Click methods: none
287
+ Disable-w-typing: n/a
288
+ Accel profiles: n/a
289
+ Rotation: n/a
290
+
291
+ Device: HDA NVidia HDMI/DP,pcm=9
292
+ Kernel: /dev/input/event20
293
+ Group: 5
294
+ Seat: seat0, default
295
+ Capabilities:
296
+ Tap-to-click: n/a
297
+ Tap-and-drag: n/a
298
+ Tap drag lock: n/a
299
+ Left-handed: n/a
300
+ Nat.scrolling: n/a
301
+ Middle emulation: n/a
302
+ Calibration: n/a
303
+ Scroll methods: none
304
+ Click methods: none
305
+ Disable-w-typing: n/a
306
+ Accel profiles: n/a
307
+ Rotation: n/a
308
+
309
+ Device: QEMU QEMU USB Tablet
310
+ Kernel: /dev/input/event2
311
+ Group: 6
312
+ Seat: seat0, default
313
+ Capabilities: pointer
314
+ Tap-to-click: n/a
315
+ Tap-and-drag: n/a
316
+ Tap drag lock: n/a
317
+ Left-handed: disabled
318
+ Nat.scrolling: disabled
319
+ Middle emulation: disabled
320
+ Calibration: identity matrix
321
+ Scroll methods: none
322
+ Click methods: none
323
+ Disable-w-typing: n/a
324
+ Accel profiles: n/a
325
+ Rotation: n/a
326
+
327
+ Device: AT Translated Set 2 keyboard
328
+ Kernel: /dev/input/event0
329
+ Group: 7
330
+ Seat: seat0, default
331
+ Capabilities: keyboard
332
+ Tap-to-click: n/a
333
+ Tap-and-drag: n/a
334
+ Tap drag lock: n/a
335
+ Left-handed: n/a
336
+ Nat.scrolling: n/a
337
+ Middle emulation: n/a
338
+ Calibration: n/a
339
+ Scroll methods: none
340
+ Click methods: none
341
+ Disable-w-typing: n/a
342
+ Accel profiles: n/a
343
+ Rotation: n/a
344
+
345
+ Device: ImExPS/2 Generic Explorer Mouse
346
+ Kernel: /dev/input/event3
347
+ Group: 8
348
+ Seat: seat0, default
349
+ Capabilities: pointer
350
+ Tap-to-click: n/a
351
+ Tap-and-drag: n/a
352
+ Tap drag lock: n/a
353
+ Left-handed: disabled
354
+ Nat.scrolling: disabled
355
+ Middle emulation: disabled
356
+ Calibration: n/a
357
+ Scroll methods: button
358
+ Click methods: none
359
+ Disable-w-typing: n/a
360
+ Accel profiles: flat *adaptive
361
+ Rotation: n/a
@@ -0,0 +1,36 @@
1
+ Device: AT Translated Set 2 keyboard
2
+ Kernel: /dev/input/event4
3
+ Group: 9
4
+ Seat: seat0, default
5
+ Capabilities: keyboard
6
+ Tap-to-click: n/a
7
+ Tap-and-drag: n/a
8
+ Tap drag lock: n/a
9
+ Left-handed: n/a
10
+ Nat.scrolling: n/a
11
+ Middle emulation: n/a
12
+ Calibration: n/a
13
+ Scroll methods: none
14
+ Click methods: none
15
+ Disable-w-typing: n/a
16
+ Accel profiles: n/a
17
+ Rotation: n/a
18
+
19
+ Device: Dell WMI hotkeys
20
+ Kernel: /dev/input/event9
21
+ Group: 10
22
+ Seat: seat0, default
23
+ Capabilities: keyboard
24
+ Tap-to-click: n/a
25
+ Tap-and-drag: n/a
26
+ Tap drag lock: n/a
27
+ Left-handed: n/a
28
+ Nat.scrolling: n/a
29
+ Middle emulation: n/a
30
+ Calibration: n/a
31
+ Scroll methods: none
32
+ Click methods: none
33
+ Disable-w-typing: n/a
34
+ Accel profiles: n/a
35
+ Rotation: n/a
36
+
@@ -0,0 +1,167 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require './lib/fusuma/libinput_command'
5
+
6
+ module Fusuma
7
+ RSpec.describe LibinputCommand do
8
+ let(:libinput_command) { described_class.new(libinput_options: libinput_options, commands: commands) }
9
+ let(:libinput_options) { [] }
10
+ let(:commands) { {} }
11
+ describe '#version' do
12
+ subject { libinput_command.version }
13
+
14
+ context 'when libinput-list-device is available' do
15
+ before do
16
+ allow(libinput_command).to receive('which')
17
+ .with('libinput') { false }
18
+ allow(libinput_command).to receive('which')
19
+ .with('libinput-list-devices') { true }
20
+ allow_any_instance_of(Kernel).to receive(:`)
21
+ .with('libinput-list-devices --version') { "1.6.3\n" }
22
+ end
23
+
24
+ it { is_expected.to eq '1.6.3' }
25
+ it { expect(libinput_command.new_cli_option_available?).to be false }
26
+ end
27
+
28
+ context 'when libinput is available' do
29
+ before do
30
+ allow(libinput_command).to receive('which')
31
+ .with('libinput') { true }
32
+ allow(libinput_command).to receive('which')
33
+ .with('libinput-list-devices') { false }
34
+ allow_any_instance_of(Kernel).to receive(:`)
35
+ .with('libinput --version') { "1.8\n" }
36
+ end
37
+
38
+ it { is_expected.to eq '1.8' }
39
+ it { expect(libinput_command.new_cli_option_available?).to be true }
40
+ end
41
+
42
+ context 'when libinput command is not found' do
43
+ before do
44
+ allow(libinput_command).to receive('which')
45
+ .with('libinput') { false }
46
+ allow(libinput_command).to receive('which')
47
+ .with('libinput-list-devices') { false }
48
+ end
49
+
50
+ it 'shold print error and exit 1' do
51
+ expect(MultiLogger).to receive(:error)
52
+ expect { subject }.to raise_error(SystemExit)
53
+ end
54
+ end
55
+ end
56
+
57
+ describe '#new_cli_option_available?' do
58
+ subject { libinput_command.new_cli_option_available? }
59
+ context 'with NEW_CLI_OPTION_VERSION' do
60
+ before do
61
+ allow(libinput_command).to receive(:version)
62
+ .and_return(LibinputCommand::NEW_CLI_OPTION_VERSION)
63
+ end
64
+ it { is_expected.to eq true }
65
+ end
66
+ context 'without NEW_CLI_OPTION_VERSION' do
67
+ before do
68
+ allow(libinput_command).to receive(:version)
69
+ .and_return(LibinputCommand::NEW_CLI_OPTION_VERSION - 0.1)
70
+ end
71
+ it { is_expected.to eq false }
72
+ end
73
+ end
74
+
75
+ describe 'list_devices' do
76
+ subject { libinput_command.list_devices }
77
+ after { subject }
78
+
79
+ before do
80
+ dummy_io = StringIO.new('dummy')
81
+ io = StringIO.new('dummy output')
82
+ allow(POSIX::Spawn).to receive(:popen4).with(anything).and_return([nil, dummy_io, io, dummy_io])
83
+ allow(Process).to receive(:waitpid).and_return(nil)
84
+ end
85
+
86
+ context 'with the alternative command' do
87
+ let(:commands) { { list_devices_command: 'dummy_list_devices' } }
88
+
89
+ it 'should call dummy events' do
90
+ expect(POSIX::Spawn).to receive(:popen4).with(/dummy_list_devices/)
91
+ end
92
+ end
93
+
94
+ context 'with new cli version' do
95
+ before do
96
+ allow(libinput_command).to receive(:new_cli_option_available?)
97
+ .and_return(true)
98
+ end
99
+
100
+ it 'call `libinput list-devices`' do
101
+ command = 'libinput list-devices'
102
+ expect(POSIX::Spawn).to receive(:popen4)
103
+ .with(command)
104
+ end
105
+ end
106
+ context 'with old cli version' do
107
+ before do
108
+ allow(libinput_command).to receive(:new_cli_option_available?)
109
+ .and_return(false)
110
+ end
111
+
112
+ it 'call `libinput-list-devices`' do
113
+ command = 'libinput-list-devices'
114
+ expect(POSIX::Spawn).to receive(:popen4)
115
+ .with(command)
116
+ end
117
+ end
118
+ end
119
+
120
+ describe 'debug_events' do
121
+ subject { libinput_command.debug_events }
122
+ before do
123
+ dummy_io = StringIO.new('dummy')
124
+ allow(POSIX::Spawn).to receive(:popen4).with(anything).and_return([nil, dummy_io, dummy_io, dummy_io])
125
+ end
126
+
127
+ context 'with the alternative command' do
128
+ let(:commands) { { debug_events_command: 'dummy_debug_events' } }
129
+
130
+ it 'should call dummy events' do
131
+ expect(POSIX::Spawn).to receive(:popen4).with(/dummy_debug_events/).once
132
+ subject
133
+ end
134
+ end
135
+
136
+ context 'with new cli version' do
137
+ before do
138
+ allow(libinput_command)
139
+ .to receive(:new_cli_option_available?)
140
+ .and_return(true)
141
+ end
142
+
143
+ it 'should call `libinput debug-events`' do
144
+ command = 'libinput debug-events'
145
+ expect(POSIX::Spawn).to receive(:popen4)
146
+ .with("stdbuf -oL -- #{command}")
147
+ subject
148
+ end
149
+ end
150
+
151
+ context 'with old cli version' do
152
+ before do
153
+ allow(libinput_command)
154
+ .to receive(:new_cli_option_available?)
155
+ .and_return(false)
156
+ end
157
+
158
+ it 'should call `libinput-debug-events`' do
159
+ command = 'libinput-debug-events'
160
+ expect(POSIX::Spawn).to receive(:popen4)
161
+ .with("stdbuf -oL -- #{command}")
162
+ subject
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end