fusuma 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93c6c3c71411a7eebb99751019f6644162214db4f26905bb5d3b1bd7eb6da917
4
- data.tar.gz: ce95d881ac734359d79dba87fc25dfc72a43ef7f4e50ed23b0ca0478883f405c
3
+ metadata.gz: 655c4a7bf0a13e28b0334d0edbc59ec29ff69b925f4495ac7f554fd1f995503f
4
+ data.tar.gz: a4678c0c54de5adf34606c82f46ebb7cc0339df7e0f7fb5fbcbb2042cc6a8e6e
5
5
  SHA512:
6
- metadata.gz: 85b9bccb20dd58f97407d7d0955e9fbf378cc1c23f7ccb502f8ae48920faefacbf2dfd2b2fa374de3fbb237d68f0c92207a83e391e0aaab7783853270a98328b
7
- data.tar.gz: 2a7cb2e707712d4c4a78e40e641137bb906adf8dbe21d2105cc7c293255f3e5a838f658fc85377a8c12de80f74211443a4bc513cbd4608dc9c611fe9929a9e5e
6
+ metadata.gz: 69a35cbdcecd922e11b590851c3b10b42a84af66ccc8d7c02f5dba9a240747cde283bd069a778b7e503be6b0558927df3897283e7730ac3ac003c185de1a5f51
7
+ data.tar.gz: 0c68f21dd7647dc846e44a71bb2cff71a46bebb2551448cf0e759727e7381258efd43ca26eb00a7580410d2d9093c03a42a3af3ccea62332167468235083de8d
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.9.0](https://github.com/iberianpig/fusuma/tree/v1.9.0) (2020-03-30)
4
+
5
+ [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.8.0...v1.9.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Touchpad is filtered in listed devices [\#156](https://github.com/iberianpig/fusuma/issues/156)
10
+
3
11
  ## [v1.8.0](https://github.com/iberianpig/fusuma/tree/v1.8.0) (2020-03-28)
4
12
 
5
13
  [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.7.0...v1.8.0)
@@ -151,8 +159,8 @@
151
159
  **Merged pull requests:**
152
160
 
153
161
  - Interval and threshold specific for a trigger [\#92](https://github.com/iberianpig/fusuma/pull/92) ([irq](https://github.com/irq))
154
- - Fix spelling: Elementary to elementary [\#90](https://github.com/iberianpig/fusuma/pull/90) ([ryonakano](https://github.com/ryonakano))
155
162
  - Assigning commands [\#73](https://github.com/iberianpig/fusuma/pull/73) ([iberianpig](https://github.com/iberianpig))
163
+ - Relax the device name regex [\#9](https://github.com/iberianpig/fusuma/pull/9) ([z0rc](https://github.com/z0rc))
156
164
 
157
165
  ## [v0.9.2](https://github.com/iberianpig/fusuma/tree/v0.9.2) (2018-07-19)
158
166
 
@@ -284,6 +292,11 @@
284
292
  - parse\_finger\_directions: undefined method `tr' for nil:NilClass \(NoMethodError\) [\#29](https://github.com/iberianpig/fusuma/issues/29)
285
293
  - Error after upgrading to libinput 1.6.0 [\#26](https://github.com/iberianpig/fusuma/issues/26)
286
294
 
295
+ **Merged pull requests:**
296
+
297
+ - Fix spelling: Elementary to elementary [\#90](https://github.com/iberianpig/fusuma/pull/90) ([ryonakano](https://github.com/ryonakano))
298
+ - Added interval options to config. [\#36](https://github.com/iberianpig/fusuma/pull/36) ([joshuatshaffer](https://github.com/joshuatshaffer))
299
+
287
300
  ## [v0.2.7](https://github.com/iberianpig/fusuma/tree/v0.2.7) (2017-02-04)
288
301
 
289
302
  [Full Changelog](https://github.com/iberianpig/fusuma/compare/v0.2.6...v0.2.7)
@@ -294,7 +307,6 @@
294
307
 
295
308
  **Merged pull requests:**
296
309
 
297
- - Added interval options to config. [\#36](https://github.com/iberianpig/fusuma/pull/36) ([joshuatshaffer](https://github.com/joshuatshaffer))
298
310
  - update parser [\#30](https://github.com/iberianpig/fusuma/pull/30) ([iberianpig](https://github.com/iberianpig))
299
311
 
300
312
  ## [v0.2.6](https://github.com/iberianpig/fusuma/tree/v0.2.6) (2017-01-22)
@@ -370,7 +382,6 @@
370
382
  **Merged pull requests:**
371
383
 
372
384
  - Match left and right actions [\#10](https://github.com/iberianpig/fusuma/pull/10) ([z0rc](https://github.com/z0rc))
373
- - Relax the device name regex [\#9](https://github.com/iberianpig/fusuma/pull/9) ([z0rc](https://github.com/z0rc))
374
385
 
375
386
  ## [v0.1.3](https://github.com/iberianpig/fusuma/tree/v0.1.3) (2016-11-01)
376
387
 
data/README.md CHANGED
@@ -7,9 +7,18 @@ This gem makes your linux able to recognize swipes or pinchs and assign commands
7
7
 
8
8
  襖(Fusuma) means sliding door used to partition off rooms in a Japanese house.
9
9
 
10
+ ## Features
11
+
12
+ - Easy installation with RubyGems
13
+ - Defining Gestures and Actions in YAML
14
+ - Sensitivity setting (threshold, interval) for gesture recognition
15
+ - Automatic device addition for reconnecting external touchpads
16
+ - Extension of gesture recognition by [plugin system](https://github.com/iberianpig/fusuma/#fusuma-plugins)
17
+
10
18
  ## Installation
11
19
 
12
20
  ### 1. Grant permission to read the touchpad device
21
+
13
22
  **IMPORTANT**: You **MUST** be a member of the **INPUT** group to read touchpad by Fusuma.
14
23
 
15
24
  ```bash
@@ -19,6 +28,7 @@ $ sudo gpasswd -a $USER input
19
28
  Then, You **MUST** **REBOOT** to assign this group.
20
29
 
21
30
  ### 2. Install libinput-tools
31
+
22
32
  You need `libinput` release 1.0 or later.
23
33
 
24
34
  ```bash
@@ -26,6 +36,7 @@ $ sudo apt-get install libinput-tools
26
36
  ```
27
37
 
28
38
  ### 3. Install Ruby
39
+
29
40
  Fusuma runs in Ruby, so you must install it first.
30
41
 
31
42
  ```bash
@@ -41,6 +52,7 @@ $ sudo gem install fusuma
41
52
  ### 5. Install xdotool (optional)
42
53
 
43
54
  For sending shortcuts:
55
+
44
56
  ```bash
45
57
  $ sudo apt-get install xdotool
46
58
  ```
@@ -49,7 +61,6 @@ $ sudo apt-get install xdotool
49
61
 
50
62
  Ensure the touchpad events are being sent to the GNOME desktop by running the following command:
51
63
 
52
-
53
64
  ```bash
54
65
  $ gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
55
66
  ```
@@ -76,12 +87,25 @@ $ mkdir -p ~/.config/fusuma # create config directory
76
87
  $ nano ~/.config/fusuma/config.yml # edit config file.
77
88
  ```
78
89
 
90
+
91
+ ### Available gestures
92
+
93
+ * `swipe:`
94
+ * support `3:`, `4:` fingers
95
+ * support `left:`, `right:`, `up:`, `down:` directions
96
+ * `pinch:`
97
+ * support `2:`, `3:`, `4:` fingers
98
+ * support `in:`, `out:` directions
99
+ * `rotate:`
100
+ * support `2:`, `3:`, `4:` fingers
101
+ * support `clockwise:`,`counterclockwise:` directions
102
+
79
103
  ### About YAML Basic Syntax
80
- * Comments in YAML begins with the (#) character.
81
- * Comments must be separated from other tokens by whitespaces.
82
- * Indentation of whitespace is used to denote structure.
83
- * Tabs are not included as indentation for YAML files.
84
104
 
105
+ - Comments in YAML begins with the `#` character.
106
+ - Comments must be separated from other tokens by whitespaces.
107
+ - Indentation of whitespace is used to denote structure.
108
+ - Tabs are not included as indentation for YAML files.
85
109
 
86
110
  ### Example: Gesture Mapping for Ubuntu
87
111
 
@@ -89,46 +113,48 @@ https://github.com/iberianpig/fusuma/wiki/Ubuntu
89
113
 
90
114
  ```yaml
91
115
  swipe:
92
- 3:
93
- left:
94
- command: 'xdotool key alt+Right'
95
- right:
96
- command: 'xdotool key alt+Left'
97
- up:
98
- command: 'xdotool key super'
99
- down:
100
- command: 'xdotool key super'
116
+ 3:
117
+ left:
118
+ command: "xdotool key alt+Right" # History forward
119
+ right:
120
+ command: "xdotool key alt+Left" # History back
121
+ up:
122
+ command: "xdotool key super" # Activity
123
+ down:
124
+ command: "xdotool key super" # Activity
101
125
  4:
102
- left:
103
- command: 'xdotool key ctrl+alt+Down'
104
- right:
105
- command: 'xdotool key ctrl+alt+Up'
106
- up:
107
- command: 'xdotool key ctrl+alt+Down'
108
- down:
109
- command: 'xdotool key ctrl+alt+Up'
126
+ left:
127
+ command: "xdotool key ctrl+alt+Down" # Switch to next workspace
128
+ right:
129
+ command: "xdotool key ctrl+alt+Up" # Switch to previous workspace
130
+ up:
131
+ command: "xdotool key ctrl+alt+Down" # Switch to next workspace
132
+ down:
133
+ command: "xdotool key ctrl+alt+Up" # Switch to previous workspace
110
134
  pinch:
111
135
  in:
112
- command: 'xdotool keydown ctrl click 4 keyup ctrl'
136
+ command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in
113
137
  out:
114
- command: 'xdotool keydown ctrl click 5 keyup ctrl'
138
+ command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out
115
139
  ```
116
140
 
117
141
  ### More Example of config.yml
118
- The following wiki pages can be edited by everyone.
119
142
 
120
- * [Ubuntu](https://github.com/iberianpig/fusuma/wiki/Ubuntu)
121
- * [elementary OS](https://github.com/iberianpig/fusuma/wiki/elementary-OS)
122
- * [i3](https://github.com/iberianpig/fusuma/wiki/i3)
123
- * [KDE to mimic MacOS](https://github.com/iberianpig/fusuma/wiki/KDE-to-mimic-MacOS)
124
- * [POP OS with Cinnamon](https://github.com/iberianpig/fusuma/wiki/POP-OS-with-Cinnamon)
125
- * [PopOS Default Gnome](https://github.com/iberianpig/fusuma/wiki/PopOS-Default-Gnome)
126
- * [Ubuntu OS to mimic Mac a little](https://github.com/iberianpig/fusuma/wiki/Ubuntu-OS-to-mimic-Mac-a-little)
143
+ The following wiki pages can be edited by everyone.
144
+
145
+ - [Ubuntu](https://github.com/iberianpig/fusuma/wiki/Ubuntu)
146
+ - [elementary OS](https://github.com/iberianpig/fusuma/wiki/elementary-OS)
147
+ - [i3](https://github.com/iberianpig/fusuma/wiki/i3)
148
+ - [KDE to mimic MacOS](https://github.com/iberianpig/fusuma/wiki/KDE-to-mimic-MacOS)
149
+ - [POP OS with Cinnamon](https://github.com/iberianpig/fusuma/wiki/POP-OS-with-Cinnamon)
150
+ - [PopOS Default Gnome](https://github.com/iberianpig/fusuma/wiki/PopOS-Default-Gnome)
151
+ - [Ubuntu OS to mimic Mac a little](https://github.com/iberianpig/fusuma/wiki/Ubuntu-OS-to-mimic-Mac-a-little)
127
152
 
128
153
  If you have a nice configuration, please share `~/.config/fusuma/config.yml` with everyone.
129
154
 
130
155
  ### Threshold and Interval
131
- if `command: ` properties are blank, the swipe/pinch doesn't execute command.
156
+
157
+ if `command:` properties are blank, the swipe/pinch doesn't execute command.
132
158
 
133
159
  `threshold:` is sensitivity to swipe/pinch. Default value is 1.
134
160
  If the swipe's threshold is `0.5`, shorten swipe-length by half.
@@ -136,13 +162,51 @@ If the swipe's threshold is `0.5`, shorten swipe-length by half.
136
162
  `interval:` is delay between swipes/pinches. Default value is 1.
137
163
  If the swipe's interval is `0.5`, shorten swipe-interval by half to recognize a next swipe.
138
164
 
139
- ### `command: ` property for assigning commands
140
- On fusuma version 0.4 `command: ` property is available!
141
- You can assign any command each gestures.
165
+ ### Example of `threshold:` / `interval:` settings
166
+
167
+ ```yaml
168
+ swipe:
169
+ 3:
170
+ left:
171
+ command: 'xdotool key alt+Right' # threshold: 0.5, interval: 0.75
172
+ threshold: 0.5
173
+ right:
174
+ command: 'xdotool key alt+Left' # threshold: 0.5, interval: 0.75
175
+ threshold: 0.5
176
+ up:
177
+ command: 'xdotool key super' # threshold: 1, interval: 0.75
178
+ down:
179
+ command: 'xdotool key super' # threshold: 1, interval: 0.75
180
+ pinch:
181
+ 2:
182
+ in:
183
+ command: "xdotool keydown ctrl click 4 keyup ctrl" # threshold: 0.5, interval: 0.5
184
+ 2:
185
+ out:
186
+ command: "xdotool keydown ctrl click 5 keyup ctrl" # threshold: 0.5, interval: 0.5
187
+
188
+ threshold:
189
+ pinch: 0.5
190
+
191
+ interval:
192
+ swipe: 0.75
193
+ pinch: 0.5
194
+ ```
142
195
 
143
- **`shortcut: ` property is deprecated**, **it was removed on fusuma version 1.0**.
144
- You need to replace to `command: ` property.
196
+ There are three priorities of `threshold:` and `interval:`.
197
+ The individual `threshold:` and `interval:` settings (under "direction") have a higher priority than the global one (under "root")
145
198
 
199
+ 1. child elements in the direction (left/right/down/up → threshold/interval)
200
+ 1. root child elements (threshold/interval → swipe/pinch)
201
+ 1. default value (= 1)
202
+
203
+ ### `command:` property for assigning commands
204
+
205
+ On fusuma version 0.4 `command:` property is available!
206
+ You can assign any command each gestures.
207
+
208
+ **`shortcut:` property is deprecated**, **it was removed on fusuma version 1.0**.
209
+ You need to replace to `command:` property.
146
210
 
147
211
  ```diff
148
212
  swipe:
@@ -157,35 +221,35 @@ swipe:
157
221
 
158
222
  ### About xdotool
159
223
 
160
-
161
- * xdotool manual (https://github.com/jordansissel/xdotool/blob/master/xdotool.pod)
162
- * Available keys' hint (https://github.com/jordansissel/xdotool/issues/212#issuecomment-406156157)
224
+ - xdotool manual (https://github.com/jordansissel/xdotool/blob/master/xdotool.pod)
225
+ - Available keys' hint (https://github.com/jordansissel/xdotool/issues/212#issuecomment-406156157)
163
226
 
164
227
  **NOTE: xdotool has some issues**
165
228
 
166
- * Gestures take a few seconds to react(https://github.com/iberianpig/fusuma/issues/113)
229
+ - Gestures take a few seconds to react(https://github.com/iberianpig/fusuma/issues/113)
167
230
 
168
231
  #### Alternatives to xdotool
169
232
 
170
- * [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
171
- * Emulates keyboard events
172
- * Wayland compatible
233
+ - [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
173
234
 
174
- * `xte`
175
- * [xte(1) - Linux man page](https://linux.die.net/man/1/xte)
176
- * install with `sudo apt xautomation`
235
+ - Emulates keyboard events
236
+ - Low latency
237
+ - Wayland compatible
177
238
 
178
- ## Options
239
+ - `xte`
240
+ - [xte(1) - Linux man page](https://linux.die.net/man/1/xte)
241
+ - install with `sudo apt xautomation`
179
242
 
180
- * `-c`, `--config=path/to/file` : Use an alternative config file
181
- * `-d`, `--daemon` : Daemonize process
182
- * `-l`, `--list-devices` : List available devices
183
- * `-v`, `--verbose` : Show details about the results of running fusuma
184
- * `--device="Device name"` : Open the given device only (DEPRECATED)
185
- * `--version` : Show fusuma version
243
+ ## Options
186
244
 
187
- ### Filter Device
245
+ - `-c`, `--config=path/to/file` : Use an alternative config file
246
+ - `-d`, `--daemon` : Daemonize process
247
+ - `-l`, `--list-devices` : List available devices
248
+ - `-v`, `--verbose` : Show details about the results of running fusuma
249
+ - `--device="Device name"` : Open the given device only (DEPRECATED)
250
+ - `--version` : Show fusuma version
188
251
 
252
+ ### Specify touchpads by device name
189
253
  Set the following options to recognize multi-touch gestures only for the specified touchpad device.
190
254
 
191
255
  ```yaml
@@ -193,10 +257,12 @@ plugin:
193
257
  filters:
194
258
  libinput_device_filter:
195
259
  keep_device_names:
196
- - "DEVICE NAME"
260
+ - "BUILT-IN TOUCHPAD NAME"
261
+ - "EXTERNAL TOUCHPAD NAME"
197
262
  ```
198
263
 
199
264
  ## Autostart (gnome-session-properties)
265
+
200
266
  1. Check the path where you installed fusuma with `$ which fusuma`
201
267
  2. Open `$ gnome-session-properties`
202
268
  3. Add Fusuma and enter the location where the above path was checked in the command input field
@@ -206,9 +272,9 @@ plugin:
206
272
 
207
273
  Following features are provided as plugins.
208
274
 
209
- * Adding new gestures or combinations
210
- * Features for specific Linux distributions
211
- * Setting different gestures per applications
275
+ - Adding new gestures or combinations
276
+ - Features for specific Linux distributions
277
+ - Setting different gestures per applications
212
278
 
213
279
  ### Installation of fusuma plugins
214
280
 
@@ -219,7 +285,7 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
219
285
  ### Available plugins
220
286
 
221
287
  | Name | About |
222
- |--------------------------------------------------------------------------------|-----------------------------------------------|
288
+ | ------------------------------------------------------------------------------ | --------------------------------------------- |
223
289
  | [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | Emulates keyboard events |
224
290
  | [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | Manages Window and Workspace |
225
291
  | [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | Detects gestures while pressing multiple keys |
@@ -227,9 +293,8 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
227
293
 
228
294
  ## Tutorial Video
229
295
 
230
- [![Multitouch Touchpad Gestures in Linux with Fusuma](http://img.youtube.com/vi/bn11Iwvf29I/0.jpg)](http://www.youtube.com/watch?v=bn11Iwvf29I "Multitouch Touchpad Gestures in Linux with Fusuma")
231
- [Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
232
-
296
+ [![Multitouch Touchpad Gestures in Linux with Fusuma](http://img.youtube.com/vi/bn11Iwvf29I/0.jpg)](http://www.youtube.com/watch?v=bn11Iwvf29I "Multitouch Touchpad Gestures in Linux with Fusuma")
297
+ [Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
233
298
 
234
299
  ## Support
235
300
 
@@ -237,16 +302,13 @@ I'm a Freelance Engineer in Japan and working on these products after finishing
237
302
  Currently, my open-source contribution times is not enough.
238
303
  If you like my work and want to contribute and become a sponsor, I will be able to focus on my projects.
239
304
 
240
- * [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
241
- * [Patreon](https://www.patreon.com/iberianpig)
242
-
305
+ - [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
306
+ - [Patreon](https://www.patreon.com/iberianpig)
243
307
 
244
308
  ## Contributing
245
309
 
246
310
  Bug reports and pull requests are welcome on GitHub at https://github.com/iberianpig/fusuma. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
247
311
 
248
-
249
312
  ## License
250
313
 
251
314
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
252
-
@@ -8,5 +8,20 @@ require 'fusuma'
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
10
  # (If you use this, don't forget to add pry to your Gemfile!)
11
+
12
+ def reload!(print = true)
13
+ puts 'Reloading ...' if print
14
+ # Main project directory.
15
+ root_dir = File.expand_path('..', __dir__)
16
+ # Directories within the project that should be reloaded.
17
+ reload_dirs = %w[lib]
18
+ # Loop through and reload every file in all relevant project directories.
19
+ reload_dirs.each do |dir|
20
+ Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
21
+ end
22
+ # Return true when complete.
23
+ true
24
+ end
25
+
11
26
  require 'pry'
12
27
  Pry.start
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open3'
4
+ require 'timeout'
4
5
 
5
6
  module Fusuma
6
7
  # Execute libinput command
7
8
  class LibinputCommand
8
- def initialize(libinput_options: [])
9
+ def initialize(libinput_options: [], commands: {})
10
+ @debug_events_command = commands[:debug_events_command]
11
+ @list_devices_command = commands[:list_devices_command]
9
12
  @libinput_options = libinput_options
10
13
  end
11
14
 
@@ -13,6 +16,9 @@ module Fusuma
13
16
  # use `libinput list-devices` and `libinput debug-events` from 1.8.
14
17
  NEW_CLI_OPTION_VERSION = 1.8
15
18
 
19
+ DEFAULT_WAIT_TIME = 0.3
20
+ TIMEOUT_MESSAGE = 'LIBINPUT TIMEOUT'
21
+
16
22
  # @return [Boolean]
17
23
  def new_cli_option_available?
18
24
  Gem::Version.new(version) >= Gem::Version.new(NEW_CLI_OPTION_VERSION)
@@ -35,12 +41,17 @@ module Fusuma
35
41
 
36
42
  # @yieldparam [String] gives a line in libinput debug-events output to the block
37
43
  def debug_events
38
- prefix = 'stdbuf -oL --'
39
- cmd = "#{prefix} #{debug_events_command} #{@libinput_options.join(' ')}".strip
40
- MultiLogger.debug(debug_events: cmd)
41
- Open3.popen3(cmd) do |_i, o, _e, _w|
42
- o.each do |line|
43
- yield(line.chomp)
44
+ MultiLogger.debug(debug_events: debug_events_with_options)
45
+ Open3.popen3(debug_events_with_options) do |_i, o, _e, _w|
46
+ loop do
47
+ line = begin
48
+ Timeout.timeout(wait_time) do
49
+ o.readline.chomp
50
+ end
51
+ rescue Timeout::Error
52
+ TIMEOUT_MESSAGE
53
+ end
54
+ yield(line)
44
55
  end
45
56
  end
46
57
  end
@@ -59,7 +70,9 @@ module Fusuma
59
70
  end
60
71
 
61
72
  def list_devices_command
62
- if new_cli_option_available?
73
+ if @list_devices_command
74
+ @list_devices_command
75
+ elsif new_cli_option_available?
63
76
  'libinput list-devices'
64
77
  else
65
78
  'libinput-list-devices'
@@ -67,15 +80,26 @@ module Fusuma
67
80
  end
68
81
 
69
82
  def debug_events_command
70
- if new_cli_option_available?
83
+ if @debug_events_command
84
+ @debug_events_command
85
+ elsif new_cli_option_available?
71
86
  'libinput debug-events'
72
87
  else
73
88
  'libinput-debug-events'
74
89
  end
75
90
  end
76
91
 
92
+ def debug_events_with_options
93
+ prefix = 'stdbuf -oL --'
94
+ "#{prefix} #{debug_events_command} #{@libinput_options.join(' ')}".strip
95
+ end
96
+
77
97
  private
78
98
 
99
+ def wait_time
100
+ DEFAULT_WAIT_TIME
101
+ end
102
+
79
103
  # which in ruby: Checking if program exists in $PATH from ruby
80
104
  # (https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby)
81
105
  # Cross-platform way of finding an executable in the $PATH.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './filter.rb'
4
+ require_relative '../../libinput_command.rb'
5
+
6
+ module Fusuma
7
+ module Plugin
8
+ module Filters
9
+ # Filter device log
10
+ class LibinputTimeoutFilter < Filter
11
+ DEFAULT_SOURCE = 'libinput_command_input'
12
+
13
+ # @return [TrueClass] when keeping it
14
+ # @return [FalseClass] when discarding it
15
+ def keep?(record)
16
+ record.to_s == LibinputCommand::TIMEOUT_MESSAGE
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../../libinput_command.rb'
3
4
  require_relative './input.rb'
4
5
 
5
6
  module Fusuma
@@ -13,12 +14,20 @@ module Fusuma
13
14
  'enable-dwt': [TrueClass, FalseClass],
14
15
  'enable-tap': [TrueClass, FalseClass],
15
16
  'show-keycodes': [TrueClass, FalseClass],
16
- 'verbose': [TrueClass, FalseClass]
17
+ 'verbose': [TrueClass, FalseClass],
18
+ 'libinput-debug-events': [String],
19
+ 'libinput-list-devices': [String]
17
20
  }
18
21
  end
19
22
 
20
23
  def run
21
- LibinputCommand.new(libinput_options: libinput_options).debug_events do |line|
24
+ LibinputCommand.new(
25
+ libinput_options: libinput_options,
26
+ commands: {
27
+ debug_events_command: debug_events_command,
28
+ list_devices_command: list_devices_command
29
+ }
30
+ ).debug_events do |line|
22
31
  yield event(record: line)
23
32
  end
24
33
  end
@@ -37,6 +46,14 @@ module Fusuma
37
46
  verbose
38
47
  ].compact
39
48
  end
49
+
50
+ def debug_events_command
51
+ config_params(:'libinput-debug-events')
52
+ end
53
+
54
+ def list_devices_command
55
+ config_params(:'libinput-list-devices')
56
+ end
40
57
  end
41
58
  end
42
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = '1.9.0'
4
+ VERSION = '1.10.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,6 +218,7 @@ files:
218
218
  - lib/fusuma/plugin/executors/executor.rb
219
219
  - lib/fusuma/plugin/filters/filter.rb
220
220
  - lib/fusuma/plugin/filters/libinput_device_filter.rb
221
+ - lib/fusuma/plugin/filters/libinput_timeout_filter.rb
221
222
  - lib/fusuma/plugin/inputs/input.rb
222
223
  - lib/fusuma/plugin/inputs/libinput_command_input.rb
223
224
  - lib/fusuma/plugin/manager.rb