fusuma 1.7.0 → 1.10.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2653f2589093ec363f62b29d398ed622314f30d9a8c902c3c7f893470c5549a0
4
- data.tar.gz: 5076d2ee1091be519a3f1eac11b536bf66120c6b9faf485e202e6bf4ecb47d20
3
+ metadata.gz: dddc8b3508264aaa617b19ed621ed6ee97c5f0d8435cb988a29a9789f9fe2a22
4
+ data.tar.gz: 8c99bd1dbddf7640d9422ed505ac090361b97b87fc0ea77584ddc6fb8f6416db
5
5
  SHA512:
6
- metadata.gz: 7433bbb5eb068c0b1f9d3d9e4492878d672105504a5603b7bd4d92c9cb61e34cbf8559e71c0b3d407bba59b5f640e9031e106e8c4cbf38c53f85f871c2517592
7
- data.tar.gz: 23425a4be0e42f0b006a424e067bed3c18be3e8768173dd8bdc6df5f070339e1613a7319de4ab70fd06981871db38210c8f26aa3e5e030cc3021a5b565d2f358
6
+ metadata.gz: 107aa86cb7e326e17e7cb5c183e3fcb49a6352fd1f9b6a04211d2820bd6e738b9abb00f2ecddeef31903f2bb77ad15b7dcc742ca835df9eb9f67e970b166e843
7
+ data.tar.gz: 294b6a9c9fd0770bf470c38af08f5c48fd7fc14d38f3acd0f802ac3f51e21d200de6d02be1f197edea65c0e5d13ee95f4e43a85c8cea0a0a80372154eda3ea15
@@ -0,0 +1,9 @@
1
+ Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
2
+
3
+ - [ ] Make sure to open an issue as a [bug/issue](https://github.com/iberianpig/fusuma/issues) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea.
4
+
5
+ - [ ] Follow the instructions in [CONTRIBUTING](https://github.com/iberianpig/fusuma/blob/master/CONTRIBUTING.md). Most importantly, ensure the tests and linter pass by running `bundle exec rspec` and `bundle exec rubocop`.
6
+
7
+ - [ ] Update code documentation if necessary.
8
+
9
+ closes: #<issue_number_goes_here>
@@ -9,8 +9,25 @@ Metrics/BlockLength:
9
9
  - "**/*_spec.rb"
10
10
  - "fusuma.gemspec"
11
11
 
12
- Metrics/LineLength:
12
+ Layout/LineLength:
13
13
  Max: 100
14
14
  Exclude:
15
15
  - "fusuma.gemspec"
16
16
  - "**/*_spec.rb"
17
+
18
+ # For rubocop < 1.0.0
19
+ Style/HashEachMethods:
20
+ Enabled: true
21
+
22
+ # For rubocop < 1.0.0
23
+ Style/HashTransformKeys:
24
+ Enabled: true
25
+
26
+ # For rubocop < 1.0.0
27
+ Style/HashTransformValues:
28
+ Enabled: true
29
+
30
+ Lint/RaiseException:
31
+ Enabled: true
32
+ Lint/StructNewOverride:
33
+ Enabled: true
@@ -7,4 +7,5 @@ rvm:
7
7
  - 2.4
8
8
  - 2.5
9
9
  - 2.6
10
+ - 2.7
10
11
  before_install: gem install bundler --no-document -v 2.0.1
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.10.0](https://github.com/iberianpig/fusuma/tree/v1.10.0) (2020-05-04)
4
+
5
+ [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.9.0...v1.10.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Each action took about 2 secs to react [\#167](https://github.com/iberianpig/fusuma/issues/167)
10
+ - ruby2.7 [\#164](https://github.com/iberianpig/fusuma/issues/164)
11
+ - Zoom-in not really usable on Vivaldi [\#159](https://github.com/iberianpig/fusuma/issues/159)
12
+ - Reversed directions with no alternatives [\#133](https://github.com/iberianpig/fusuma/issues/133)
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Implement timeout event [\#169](https://github.com/iberianpig/fusuma/pull/169) ([iberianpig](https://github.com/iberianpig))
17
+
18
+ ## [v1.9.0](https://github.com/iberianpig/fusuma/tree/v1.9.0) (2020-03-30)
19
+
20
+ [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.8.0...v1.9.0)
21
+
22
+ **Closed issues:**
23
+
24
+ - Touchpad is filtered in listed devices [\#156](https://github.com/iberianpig/fusuma/issues/156)
25
+
26
+ ## [v1.8.0](https://github.com/iberianpig/fusuma/tree/v1.8.0) (2020-03-28)
27
+
28
+ [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.7.0...v1.8.0)
29
+
30
+ **Implemented enhancements:**
31
+
32
+ - Capturing Finger Taps on Touchpad [\#152](https://github.com/iberianpig/fusuma/issues/152)
33
+
34
+ **Closed issues:**
35
+
36
+ - When xdotool acts crazy. Workaround should be clearly informed. [\#146](https://github.com/iberianpig/fusuma/issues/146)
37
+
38
+ **Merged pull requests:**
39
+
40
+ - Fix cops [\#158](https://github.com/iberianpig/fusuma/pull/158) ([iberianpig](https://github.com/iberianpig))
41
+ - Add ruby 2.7 to .travis.yml [\#157](https://github.com/iberianpig/fusuma/pull/157) ([iberianpig](https://github.com/iberianpig))
42
+
43
+ ## [v1.7.0](https://github.com/iberianpig/fusuma/tree/v1.7.0) (2020-03-25)
44
+
45
+ [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.6.0...v1.7.0)
46
+
3
47
  ## [v1.6.0](https://github.com/iberianpig/fusuma/tree/v1.6.0) (2020-03-14)
4
48
 
5
49
  [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.5.0...v1.6.0)
@@ -0,0 +1,72 @@
1
+ # Contributing to Fusuma
2
+
3
+ 1. Fork the repo, develop and test your code changes.
4
+ 2. Send a pull request.
5
+
6
+ ## Setup
7
+
8
+ In order to use the Fusuma console and run the project's tests,
9
+ there is a small amount of setup:
10
+
11
+ 1. Install Ruby. Fusuma requires Ruby 2.3+. You may choose to
12
+ manage your Ruby and gem installations with [RVM](https://rvm.io/),
13
+ [rbenv](https://github.com/rbenv/rbenv), or
14
+ [chruby](https://github.com/postmodern/chruby).
15
+
16
+ 2. Install [Bundler](http://bundler.io/).
17
+
18
+ ```sh
19
+ $ gem install bundler
20
+ ```
21
+
22
+ 3. Install the top-level project dependencies.
23
+
24
+ ```sh
25
+ $ bundle install
26
+ ```
27
+
28
+ ## Fusuma Tests
29
+
30
+ Tests are very important part of Fusuma. All contributions
31
+ should include tests that ensure the contributed code behaves as expected.
32
+
33
+ To run tests:
34
+
35
+ ``` sh
36
+ $ bundle exec rspec
37
+ ```
38
+
39
+ ### Fusuma Document
40
+
41
+ The project uses [YARD](https://github.com/lsegal/yard) for generating documentation.
42
+
43
+ If you're not sure about YARD, please refer to [YARD cheatsheet](https://gist.github.com/phansch/db18a595d2f5f1ef16646af72fe1fb0e).
44
+
45
+ To run the Fusuma documentation tests:
46
+
47
+ ``` sh
48
+ $ bundle exec yard --fail-on-warning
49
+ ```
50
+
51
+ To check Fusuma documents with running local server:
52
+
53
+ ```
54
+ $ bundle exec yard server
55
+ ```
56
+ Then open (http://localhost:8808/)
57
+
58
+ ## Coding Style
59
+
60
+ Please follow the established coding style in the library.
61
+ The style is is largely based on [The Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide).
62
+
63
+ You can check your code against these rules by running Rubocop like so:
64
+
65
+ ```sh
66
+ $ bundle exec rubocop
67
+ ```
68
+
69
+ ## Code of Conduct
70
+
71
+ Please note that this project is released with a Contributor Code of Conduct. By
72
+ participating in this project you agree to abide by its terms.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fusuma [![Gem Version](https://badge.fury.io/rb/fusuma.svg)](https://badge.fury.io/rb/fusuma) [![Build Status](https://travis-ci.com/iberianpig/fusuma.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma)
1
+ # Fusuma [![Gem Version](https://badge.fury.io/rb/fusuma.svg)](https://badge.fury.io/rb/fusuma) [![Build Status](https://travis-ci.com/iberianpig/fusuma.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma) [![Coverage Status](https://coveralls.io/repos/github/iberianpig/fusuma/badge.svg?branch=master)](https://coveralls.io/github/iberianpig/fusuma?branch=master) [![Inline docs](http://inch-ci.org/github/iberianpig/fusuma.svg?branch=master)](http://inch-ci.org/github/iberianpig/fusuma)
2
2
 
3
3
  Fusuma is multitouch gesture recognizer.
4
4
  This gem makes your linux able to recognize swipes or pinchs and assign commands to them.
@@ -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,100 +87,74 @@ $ mkdir -p ~/.config/fusuma # create config directory
76
87
  $ nano ~/.config/fusuma/config.yml # edit config file.
77
88
  ```
78
89
 
79
- ### 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
90
 
91
+ ### Available gestures
85
92
 
86
- ### Example 1: Gesture Mapping for elementary OS
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
87
102
 
88
- ```yaml
89
- swipe:
90
- 3:
91
- left:
92
- command: 'xdotool key alt+Left'
93
- right:
94
- command: 'xdotool key alt+Right'
95
- up:
96
- command: 'xdotool key ctrl+t'
97
- threshold: 1.5
98
- down:
99
- command: 'xdotool key ctrl+w'
100
- threshold: 1.5
101
- 4:
102
- left:
103
- command: 'xdotool key super+Left'
104
- right:
105
- command: 'xdotool key super+Right'
106
- up:
107
- command: 'xdotool key super+a'
108
- down:
109
- command: 'xdotool key super+s'
110
- pinch:
111
- 2:
112
- in:
113
- command: 'xdotool key ctrl+plus'
114
- threshold: 0.1
115
- out:
116
- command: 'xdotool key ctrl+minus'
117
- threshold: 0.1
103
+ ### About YAML Basic Syntax
118
104
 
119
- threshold:
120
- swipe: 1
121
- pinch: 1
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.
122
109
 
123
- interval:
124
- swipe: 1
125
- pinch: 1
126
- ```
110
+ ### Example: Gesture Mapping for Ubuntu
127
111
 
128
- ### Example 2: Gesture Mapping for Ubuntu OS to mimic Mac a little
112
+ https://github.com/iberianpig/fusuma/wiki/Ubuntu
129
113
 
130
114
  ```yaml
131
115
  swipe:
132
116
  3:
133
117
  left:
134
- command: 'xdotool key alt+Shift+Tab'
118
+ command: "xdotool key alt+Right" # History forward
135
119
  right:
136
- command: 'xdotool key alt+Tab'
120
+ command: "xdotool key alt+Left" # History back
137
121
  up:
138
- command: 'xdotool key super'
122
+ command: "xdotool key super" # Activity
139
123
  down:
140
- command: 'xdotool key super'
124
+ command: "xdotool key super" # Activity
141
125
  4:
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
142
130
  up:
143
- command: 'xdotool key super+m'
131
+ command: "xdotool key ctrl+alt+Down" # Switch to next workspace
144
132
  down:
145
- command: 'xdotool key super+m'
133
+ command: "xdotool key ctrl+alt+Up" # Switch to previous workspace
146
134
  pinch:
147
135
  in:
148
- command: 'xdotool key super+a'
149
- threshold: 0.1
136
+ command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in
150
137
  out:
151
- command: 'xdotool key super'
152
- threshold: 0.1
153
-
154
- threshold:
155
- swipe: 1
156
- pinch: 1
157
-
158
- interval:
159
- swipe: 1
160
- pinch: 1
161
-
138
+ command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out
162
139
  ```
163
140
 
164
- ### More Example
141
+ ### More Example of config.yml
142
+
165
143
  The following wiki pages can be edited by everyone.
166
144
 
167
- https://github.com/iberianpig/fusuma/wiki/
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)
168
152
 
169
153
  If you have a nice configuration, please share `~/.config/fusuma/config.yml` with everyone.
170
154
 
171
155
  ### Threshold and Interval
172
- 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.
173
158
 
174
159
  `threshold:` is sensitivity to swipe/pinch. Default value is 1.
175
160
  If the swipe's threshold is `0.5`, shorten swipe-length by half.
@@ -177,13 +162,50 @@ If the swipe's threshold is `0.5`, shorten swipe-length by half.
177
162
  `interval:` is delay between swipes/pinches. Default value is 1.
178
163
  If the swipe's interval is `0.5`, shorten swipe-interval by half to recognize a next swipe.
179
164
 
180
- ### `command: ` property for assigning commands
181
- On fusuma version 0.4 `command: ` property is available!
182
- 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
+ out:
185
+ command: "xdotool keydown ctrl click 5 keyup ctrl" # threshold: 0.5, interval: 0.5
186
+
187
+ threshold:
188
+ pinch: 0.5
189
+
190
+ interval:
191
+ swipe: 0.75
192
+ pinch: 0.5
193
+ ```
183
194
 
184
- **`shortcut: ` property is deprecated**, **it was removed on fusuma version 1.0**.
185
- You need to replace to `command: ` property.
195
+ There are three priorities of `threshold:` and `interval:`.
196
+ The individual `threshold:` and `interval:` settings (under "direction") have a higher priority than the global one (under "root")
186
197
 
198
+ 1. child elements in the direction (left/right/down/up → threshold/interval)
199
+ 1. root child elements (threshold/interval → swipe/pinch)
200
+ 1. default value (= 1)
201
+
202
+ ### `command:` property for assigning commands
203
+
204
+ On fusuma version 0.4 `command:` property is available!
205
+ You can assign any command each gestures.
206
+
207
+ **`shortcut:` property is deprecated**, **it was removed on fusuma version 1.0**.
208
+ You need to replace to `command:` property.
187
209
 
188
210
  ```diff
189
211
  swipe:
@@ -198,34 +220,53 @@ swipe:
198
220
 
199
221
  ### About xdotool
200
222
 
201
-
202
- * xdotool manual (https://github.com/jordansissel/xdotool/blob/master/xdotool.pod)
203
- * Available keys' hint (https://github.com/jordansissel/xdotool/issues/212#issuecomment-406156157)
223
+ - xdotool manual (https://github.com/jordansissel/xdotool/blob/master/xdotool.pod)
224
+ - Available keys' hint (https://github.com/jordansissel/xdotool/issues/212#issuecomment-406156157)
204
225
 
205
226
  **NOTE: xdotool has some issues**
206
227
 
207
- * Gestures take a few seconds to react(https://github.com/iberianpig/fusuma/issues/113)
228
+ - Gestures take a few seconds to react(https://github.com/iberianpig/fusuma/issues/113)
208
229
 
209
230
  #### Alternatives to xdotool
210
231
 
211
- * [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
212
- * Emulates keyboard events
213
- * Wayland compatible
232
+ - [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
233
+
234
+ - Emulates keyboard events
235
+ - Low latency
236
+ - Wayland compatible
214
237
 
215
- * `xte`
216
- * [xte(1) - Linux man page](https://linux.die.net/man/1/xte)
217
- * install with `sudo apt xautomation`
238
+ - `xte`
239
+ - [xte(1) - Linux man page](https://linux.die.net/man/1/xte)
240
+ - install with `sudo apt xautomation`
241
+
242
+ - [ydotool](https://github.com/ReimuNotMoe/ydotool)
243
+ - Wayland compatible
244
+ - Needs more maintainers.
245
+ - Requires only replacing `xdotool` with `ydotool` in in fusuma conf.
218
246
 
219
247
  ## Options
220
248
 
221
- * `-c`, `--config=path/to/file` : Use an alternative config file
222
- * `-d`, `--daemon` : Daemonize process
223
- * `-l`, `--list-devices` : List available devices
224
- * `-v`, `--verbose` : Show details about the results of running fusuma
225
- * `--device="Device name"` : Open the given device only
226
- * `--version` : Show fusuma version
249
+ - `-c`, `--config=path/to/file` : Use an alternative config file
250
+ - `-d`, `--daemon` : Daemonize process
251
+ - `-l`, `--list-devices` : List available devices
252
+ - `-v`, `--verbose` : Show details about the results of running fusuma
253
+ - `--device="Device name"` : Open the given device only (DEPRECATED)
254
+ - `--version` : Show fusuma version
255
+
256
+ ### Specify touchpads by device name
257
+ Set the following options to recognize multi-touch gestures only for the specified touchpad device.
258
+
259
+ ```yaml
260
+ plugin:
261
+ filters:
262
+ libinput_device_filter:
263
+ keep_device_names:
264
+ - "BUILT-IN TOUCHPAD NAME"
265
+ - "EXTERNAL TOUCHPAD NAME"
266
+ ```
227
267
 
228
268
  ## Autostart (gnome-session-properties)
269
+
229
270
  1. Check the path where you installed fusuma with `$ which fusuma`
230
271
  2. Open `$ gnome-session-properties`
231
272
  3. Add Fusuma and enter the location where the above path was checked in the command input field
@@ -235,9 +276,9 @@ swipe:
235
276
 
236
277
  Following features are provided as plugins.
237
278
 
238
- * Adding new gestures or combinations
239
- * Features for specific Linux distributions
240
- * Setting different gestures per applications
279
+ - Adding new gestures or combinations
280
+ - Features for specific Linux distributions
281
+ - Setting different gestures per applications
241
282
 
242
283
  ### Installation of fusuma plugins
243
284
 
@@ -248,7 +289,7 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
248
289
  ### Available plugins
249
290
 
250
291
  | Name | About |
251
- |--------------------------------------------------------------------------------|-----------------------------------------------|
292
+ | ------------------------------------------------------------------------------ | --------------------------------------------- |
252
293
  | [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | Emulates keyboard events |
253
294
  | [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | Manages Window and Workspace |
254
295
  | [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | Detects gestures while pressing multiple keys |
@@ -256,9 +297,8 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
256
297
 
257
298
  ## Tutorial Video
258
299
 
259
- [![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")
260
- [Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
261
-
300
+ [![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")
301
+ [Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
262
302
 
263
303
  ## Support
264
304
 
@@ -266,16 +306,13 @@ I'm a Freelance Engineer in Japan and working on these products after finishing
266
306
  Currently, my open-source contribution times is not enough.
267
307
  If you like my work and want to contribute and become a sponsor, I will be able to focus on my projects.
268
308
 
269
- * [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
270
- * [Patreon](https://www.patreon.com/iberianpig)
271
-
309
+ - [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
310
+ - [Patreon](https://www.patreon.com/iberianpig)
272
311
 
273
312
  ## Contributing
274
313
 
275
314
  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.
276
315
 
277
-
278
316
  ## License
279
317
 
280
318
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
281
-
@@ -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
data/exe/fusuma CHANGED
@@ -23,7 +23,7 @@ opt.on('-l', '--list-devices',
23
23
  end
24
24
 
25
25
  opt.on('--device="Device name"',
26
- 'Open the given device only') do |v|
26
+ 'Open the given device only (DEPRECATED)') do |v|
27
27
  option[:device] = v
28
28
  end
29
29
 
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.required_ruby_version = '>= 2.3' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all&section=main
27
27
  spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'coveralls'
28
29
  spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
29
30
  spec.add_development_dependency 'pry-byebug', '~> 3.4'
30
31
  spec.add_development_dependency 'pry-doc'
@@ -3,8 +3,8 @@
3
3
  require_relative './fusuma/version'
4
4
  require_relative './fusuma/multi_logger'
5
5
  require_relative './fusuma/config.rb'
6
+ require_relative './fusuma/environment.rb'
6
7
  require_relative './fusuma/device.rb'
7
- require_relative './fusuma/libinput_command.rb'
8
8
  require_relative './fusuma/plugin/manager.rb'
9
9
 
10
10
  # this is top level module
@@ -31,40 +31,20 @@ module Fusuma
31
31
 
32
32
  load_custom_config(option[:config_path])
33
33
 
34
- Plugin::Manager.require_plugins_from_relative
34
+ Plugin::Manager.require_base_plugins
35
35
 
36
- MultiLogger.info '---------------------------------------------'
37
- print_version
38
- MultiLogger.info '---------------------------------------------'
39
- print_enabled_plugins
40
- MultiLogger.info '---------------------------------------------'
36
+ Environment.dump_information
41
37
  Kernel.exit(0) if option[:version]
42
38
 
43
- print_device_list if option[:list]
39
+ if option[:list]
40
+ Environment.print_device_list
41
+ Kernel.exit(0)
42
+ end
43
+
44
44
  # TODO: remove keep_device_from_option from command line options
45
45
  Plugin::Filters::LibinputDeviceFilter::KeepDevice.from_option = option[:device]
46
- Process.daemon if option[:daemon]
47
- end
48
46
 
49
- def print_version
50
- MultiLogger.info "Fusuma: #{Fusuma::VERSION}"
51
- MultiLogger.info "libinput: #{LibinputCommand.new.version}"
52
- MultiLogger.info "OS: #{`uname -rsv`}".strip
53
- MultiLogger.info "Distribution: #{`cat /etc/issue`}".strip
54
- MultiLogger.info "Desktop session: #{`echo $DESKTOP_SESSION $XDG_SESSION_TYPE`}".strip
55
- end
56
-
57
- def print_enabled_plugins
58
- MultiLogger.info 'Enabled Plugins: '
59
- Plugin::Manager.plugins
60
- .reject { |k, _v| k.to_s =~ /Base/ }
61
- .map { |_base, plugins| plugins.map { |plugin| " #{plugin}" } }
62
- .flatten.sort.each { |name| MultiLogger.info(name) }
63
- end
64
-
65
- def print_device_list
66
- puts Device.available.map(&:name)
67
- exit(0)
47
+ Process.daemon if option[:daemon]
68
48
  end
69
49
 
70
50
  def load_custom_config(config_path = nil)
@@ -86,7 +66,7 @@ module Fusuma
86
66
  def run
87
67
  # TODO: run with multi thread
88
68
  @inputs.first.run do |event|
89
- clear_expired
69
+ clear_expired_events
90
70
  filtered = filter(event) || next
91
71
  parsed = parse(filtered) || next
92
72
  buffered = buffer(parsed) || next
@@ -139,7 +119,7 @@ module Fusuma
139
119
  executor&.execute(event)
140
120
  end
141
121
 
142
- def clear_expired
122
+ def clear_expired_events
143
123
  @buffers.each(&:clear_expired)
144
124
  end
145
125
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './version.rb'
4
+ require_relative './libinput_command.rb'
5
+ require_relative './multi_logger.rb'
6
+
7
+ module Fusuma
8
+ # Output Environment information
9
+ class Environment
10
+ class << self
11
+ def dump_information
12
+ MultiLogger.info '---------------------------------------------'
13
+ print_version
14
+ MultiLogger.info '---------------------------------------------'
15
+ print_enabled_plugins
16
+ MultiLogger.info '---------------------------------------------'
17
+ end
18
+
19
+ def print_version
20
+ MultiLogger.info "Fusuma: #{VERSION}"
21
+ MultiLogger.info "libinput: #{LibinputCommand.new.version}"
22
+ MultiLogger.info "OS: #{`uname -rsv`}".strip
23
+ MultiLogger.info "Distribution: #{`cat /etc/issue`}".strip
24
+ MultiLogger.info "Desktop session: #{`echo $DESKTOP_SESSION $XDG_SESSION_TYPE`}".strip
25
+ end
26
+
27
+ def print_enabled_plugins
28
+ MultiLogger.info 'Enabled Plugins: '
29
+ Plugin::Manager.plugins
30
+ .reject { |k, _v| k.to_s =~ /Base/ }
31
+ .map { |_base, plugins| plugins.map { |plugin| " #{plugin}" } }
32
+ .flatten.sort.each { |name| MultiLogger.info(name) }
33
+ end
34
+
35
+ def print_device_list
36
+ Plugin::Filters::LibinputDeviceFilter.new.keep_device.all.map do |device|
37
+ puts device.name
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -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.
@@ -14,10 +14,13 @@ module Fusuma
14
14
  Delta = Struct.new(:move_x, :move_y, :zoom, :rotate)
15
15
 
16
16
  # @param status [String]
17
+ # @param gesture [String]
18
+ # @param finger [String, Integer]
19
+ # @param direction [Delta, NilClass]
17
20
  def initialize(status:, gesture:, finger:, direction:)
18
21
  @status = status
19
22
  @gesture = gesture
20
- @finger = finger
23
+ @finger = finger.to_i
21
24
  @direction = direction
22
25
  end
23
26
  end
@@ -36,12 +36,26 @@ module Fusuma
36
36
  end
37
37
  end
38
38
 
39
+ def config_param_sample
40
+ <<~SAMPLE
41
+ ```config.yml
42
+ plugin:
43
+ filters:
44
+ libinput_device_filter:
45
+ keep_device_names:
46
+ - "DEVICE NAME PATTERN"
47
+ ```
48
+ SAMPLE
49
+ end
50
+
39
51
  # Select Device to keep
40
52
  class KeepDevice
41
53
  def initialize(name_patterns:)
42
54
  @name_patterns = name_patterns | Array(self.class.from_option)
43
55
  end
44
56
 
57
+ attr_reader :name_patterns
58
+
45
59
  # remove cache for reloading new devices
46
60
  def reset
47
61
  @all = nil
@@ -56,9 +70,16 @@ module Fusuma
56
70
  Device.all.select do |device|
57
71
  match_pattern?(device.name)
58
72
  end
73
+ end.tap do |devices|
74
+ print_not_found_messages if devices.empty?
59
75
  end
60
76
  end
61
77
 
78
+ def print_not_found_messages
79
+ puts 'Device is not found. Check following section on your config.yml'
80
+ puts LibinputDeviceFilter.new.config_param_sample
81
+ end
82
+
62
83
  # @return [TrueClass]
63
84
  # @return [FalseClass]
64
85
  def match_pattern?(string)
@@ -68,8 +89,20 @@ module Fusuma
68
89
  end
69
90
 
70
91
  class << self
92
+ attr_reader :from_option
93
+
71
94
  # TODO: remove from_option and command line options
72
- attr_accessor :from_option
95
+ def from_option=(device)
96
+ if device
97
+ warn <<~COMMENT
98
+ Don't use --device="Device name" option because it is deprecated.
99
+ Use the options below instead.
100
+
101
+ #{LibinputDeviceFilter.new.config_param_sample}
102
+ COMMENT
103
+ end
104
+ @from_option = device
105
+ end
73
106
  end
74
107
  end
75
108
  end
@@ -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
@@ -20,7 +20,7 @@ module Fusuma
20
20
 
21
21
  def require_siblings_from_gems
22
22
  search_key = File.join(plugin_dir_name, '*.rb')
23
- Gem.find_files(search_key).each do |siblings_plugin|
23
+ Gem.find_latest_files(search_key).each do |siblings_plugin|
24
24
  if siblings_plugin =~ %r{fusuma-plugin-(.+).*/lib/#{plugin_dir_name}/\1_.+.rb}
25
25
  require siblings_plugin
26
26
  end
@@ -57,7 +57,7 @@ module Fusuma
57
57
  manager.require_siblings_from_gems
58
58
  end
59
59
 
60
- def require_plugins_from_relative
60
+ def require_base_plugins
61
61
  require_relative './base.rb'
62
62
  require_relative './events/event.rb'
63
63
  require_relative './inputs/input.rb'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = '1.7.0'
4
+ VERSION = '1.10.2'
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.7.0
4
+ version: 1.10.2
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-25 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: github_changelog_generator
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +177,7 @@ files:
163
177
  - ".github/FUNDING.yml"
164
178
  - ".github/ISSUE_TEMPLATE/bug_report.md"
165
179
  - ".github/ISSUE_TEMPLATE/feature_request.md"
180
+ - ".github/pull_request_template.md"
166
181
  - ".github/stale.yml"
167
182
  - ".gitignore"
168
183
  - ".reek.yml"
@@ -172,6 +187,7 @@ files:
172
187
  - ".travis.yml"
173
188
  - CHANGELOG.md
174
189
  - CODE_OF_CONDUCT.md
190
+ - CONTRIBUTING.md
175
191
  - Gemfile
176
192
  - LICENSE
177
193
  - README.md
@@ -185,6 +201,7 @@ files:
185
201
  - lib/fusuma/config.yml
186
202
  - lib/fusuma/config/index.rb
187
203
  - lib/fusuma/device.rb
204
+ - lib/fusuma/environment.rb
188
205
  - lib/fusuma/libinput_command.rb
189
206
  - lib/fusuma/multi_logger.rb
190
207
  - lib/fusuma/plugin/base.rb
@@ -203,6 +220,7 @@ files:
203
220
  - lib/fusuma/plugin/executors/executor.rb
204
221
  - lib/fusuma/plugin/filters/filter.rb
205
222
  - lib/fusuma/plugin/filters/libinput_device_filter.rb
223
+ - lib/fusuma/plugin/filters/libinput_timeout_filter.rb
206
224
  - lib/fusuma/plugin/inputs/input.rb
207
225
  - lib/fusuma/plugin/inputs/libinput_command_input.rb
208
226
  - lib/fusuma/plugin/manager.rb