fusuma 1.8.0 → 1.11.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.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +9 -0
- data/.rubocop.yml +21 -0
- data/CHANGELOG.md +67 -2
- data/CONTRIBUTING.md +72 -0
- data/README.md +145 -67
- data/bin/console +15 -0
- data/exe/fusuma +1 -1
- data/fusuma.gemspec +1 -0
- data/lib/fusuma.rb +10 -32
- data/lib/fusuma/config.rb +34 -7
- data/lib/fusuma/config/yaml_duplication_checker.rb +42 -0
- data/lib/fusuma/environment.rb +42 -0
- data/lib/fusuma/libinput_command.rb +33 -9
- data/lib/fusuma/plugin/events/records/gesture_record.rb +4 -1
- data/lib/fusuma/plugin/filters/libinput_device_filter.rb +34 -1
- data/lib/fusuma/plugin/filters/libinput_timeout_filter.rb +21 -0
- data/lib/fusuma/plugin/inputs/libinput_command_input.rb +19 -2
- data/lib/fusuma/version.rb +1 -1
- metadata +22 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd9b74b06494e85c0caf6250e0dfeed80c37187098982b4f32c2dd8e727732fb
|
|
4
|
+
data.tar.gz: eb8c3d19693570b77b26519d7296856480342eec3eba0205ed970e01a4b46a16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abe0b55ab9f332d3f67c423b0890135973d57a4cf8b7d6fafc7b01b44874c2489b6752fcb7a66d0b0a625c612879e35ce7d11b6a3b5ce485711b84e8f45e5279
|
|
7
|
+
data.tar.gz: 323c35769c6f9827f8a94532a4dd10a25facf6bc6858d85b2b6540a6d78064e9003d4ccb83f4914f214aa6523cea8878b5f63abbe113211b1b0900ce0e203521
|
|
@@ -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>
|
data/.rubocop.yml
CHANGED
|
@@ -14,3 +14,24 @@ Layout/LineLength:
|
|
|
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
|
+
# For compatible ruby 2.3
|
|
31
|
+
Style/RedundantBegin:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
Lint/RaiseException:
|
|
35
|
+
Enabled: true
|
|
36
|
+
Lint/StructNewOverride:
|
|
37
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [v1.11.0](https://github.com/iberianpig/fusuma/tree/v1.11.0) (2020-07-25)
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.
|
|
5
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.2...v1.11.0)
|
|
6
|
+
|
|
7
|
+
**Implemented enhancements:**
|
|
8
|
+
|
|
9
|
+
- Feature/yaml check [\#193](https://github.com/iberianpig/fusuma/pull/193) ([iberianpig](https://github.com/iberianpig))
|
|
10
|
+
|
|
11
|
+
## [v1.10.2](https://github.com/iberianpig/fusuma/tree/v1.10.2) (2020-07-23)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.1...v1.10.2)
|
|
14
|
+
|
|
15
|
+
**Closed issues:**
|
|
16
|
+
|
|
17
|
+
- Gestures from libinput are not recognised [\#192](https://github.com/iberianpig/fusuma/issues/192)
|
|
18
|
+
- Vertical 4 finger swipe and rotation not recognised [\#189](https://github.com/iberianpig/fusuma/issues/189)
|
|
19
|
+
- Pinch in gesture not recognized in Popos 20.04 \(Ubuntu 20.04\) [\#184](https://github.com/iberianpig/fusuma/issues/184)
|
|
20
|
+
- Fusuma crashes while switching between workspaces on KDE Plasma [\#181](https://github.com/iberianpig/fusuma/issues/181)
|
|
21
|
+
- Window Prev/Next moves desktop environment when no active window [\#178](https://github.com/iberianpig/fusuma/issues/178)
|
|
22
|
+
- Add ydotool to docs. [\#177](https://github.com/iberianpig/fusuma/issues/177)
|
|
23
|
+
- Can't use alternative .config.yml [\#176](https://github.com/iberianpig/fusuma/issues/176)
|
|
24
|
+
- Fusuma stops working sometimes [\#175](https://github.com/iberianpig/fusuma/issues/175)
|
|
25
|
+
- Pinch \(2, in\) does not work. [\#174](https://github.com/iberianpig/fusuma/issues/174)
|
|
26
|
+
|
|
27
|
+
**Merged pull requests:**
|
|
28
|
+
|
|
29
|
+
- 177. Add ydootool to docs. [\#179](https://github.com/iberianpig/fusuma/pull/179) ([mattdemarillac](https://github.com/mattdemarillac))
|
|
30
|
+
|
|
31
|
+
## [v1.10.1](https://github.com/iberianpig/fusuma/tree/v1.10.1) (2020-05-15)
|
|
32
|
+
|
|
33
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.0...v1.10.1)
|
|
34
|
+
|
|
35
|
+
**Closed issues:**
|
|
36
|
+
|
|
37
|
+
- Some gestures are not always recognized [\#172](https://github.com/iberianpig/fusuma/issues/172)
|
|
38
|
+
- Unable to reprogram Pinch [\#171](https://github.com/iberianpig/fusuma/issues/171)
|
|
39
|
+
|
|
40
|
+
## [v1.10.0](https://github.com/iberianpig/fusuma/tree/v1.10.0) (2020-05-04)
|
|
41
|
+
|
|
42
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.9.0...v1.10.0)
|
|
43
|
+
|
|
44
|
+
**Closed issues:**
|
|
45
|
+
|
|
46
|
+
- Each action took about 2 secs to react [\#167](https://github.com/iberianpig/fusuma/issues/167)
|
|
47
|
+
- ruby2.7 [\#164](https://github.com/iberianpig/fusuma/issues/164)
|
|
48
|
+
- Zoom-in not really usable on Vivaldi [\#159](https://github.com/iberianpig/fusuma/issues/159)
|
|
49
|
+
- Reversed directions with no alternatives [\#133](https://github.com/iberianpig/fusuma/issues/133)
|
|
50
|
+
|
|
51
|
+
**Merged pull requests:**
|
|
52
|
+
|
|
53
|
+
- Implement timeout event [\#169](https://github.com/iberianpig/fusuma/pull/169) ([iberianpig](https://github.com/iberianpig))
|
|
54
|
+
|
|
55
|
+
## [v1.9.0](https://github.com/iberianpig/fusuma/tree/v1.9.0) (2020-03-30)
|
|
56
|
+
|
|
57
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.8.0...v1.9.0)
|
|
58
|
+
|
|
59
|
+
**Closed issues:**
|
|
60
|
+
|
|
61
|
+
- Touchpad is filtered in listed devices [\#156](https://github.com/iberianpig/fusuma/issues/156)
|
|
62
|
+
|
|
63
|
+
## [v1.8.0](https://github.com/iberianpig/fusuma/tree/v1.8.0) (2020-03-28)
|
|
64
|
+
|
|
65
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.7.0...v1.8.0)
|
|
6
66
|
|
|
7
67
|
**Implemented enhancements:**
|
|
8
68
|
|
|
@@ -12,6 +72,11 @@
|
|
|
12
72
|
|
|
13
73
|
- When xdotool acts crazy. Workaround should be clearly informed. [\#146](https://github.com/iberianpig/fusuma/issues/146)
|
|
14
74
|
|
|
75
|
+
**Merged pull requests:**
|
|
76
|
+
|
|
77
|
+
- Fix cops [\#158](https://github.com/iberianpig/fusuma/pull/158) ([iberianpig](https://github.com/iberianpig))
|
|
78
|
+
- Add ruby 2.7 to .travis.yml [\#157](https://github.com/iberianpig/fusuma/pull/157) ([iberianpig](https://github.com/iberianpig))
|
|
79
|
+
|
|
15
80
|
## [v1.7.0](https://github.com/iberianpig/fusuma/tree/v1.7.0) (2020-03-25)
|
|
16
81
|
|
|
17
82
|
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.6.0...v1.7.0)
|
data/CONTRIBUTING.md
ADDED
|
@@ -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 [](https://badge.fury.io/rb/fusuma) [](https://travis-ci.com/iberianpig/fusuma)
|
|
1
|
+
# Fusuma [](https://badge.fury.io/rb/fusuma) [](https://travis-ci.com/iberianpig/fusuma) [](https://coveralls.io/github/iberianpig/fusuma?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,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:
|
|
95
|
-
right:
|
|
96
|
-
command:
|
|
97
|
-
up:
|
|
98
|
-
command:
|
|
99
|
-
down:
|
|
100
|
-
command:
|
|
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:
|
|
104
|
-
right:
|
|
105
|
-
command:
|
|
106
|
-
up:
|
|
107
|
-
command:
|
|
108
|
-
down:
|
|
109
|
-
command:
|
|
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:
|
|
136
|
+
command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in
|
|
113
137
|
out:
|
|
114
|
-
command:
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
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,50 @@ 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
|
-
###
|
|
140
|
-
|
|
141
|
-
|
|
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
|
+
```
|
|
194
|
+
|
|
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")
|
|
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)
|
|
142
201
|
|
|
143
|
-
|
|
144
|
-
You need to replace to `command: ` property.
|
|
202
|
+
### `command:` property for assigning commands
|
|
145
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.
|
|
146
209
|
|
|
147
210
|
```diff
|
|
148
211
|
swipe:
|
|
@@ -157,34 +220,53 @@ swipe:
|
|
|
157
220
|
|
|
158
221
|
### About xdotool
|
|
159
222
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* 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)
|
|
163
225
|
|
|
164
226
|
**NOTE: xdotool has some issues**
|
|
165
227
|
|
|
166
|
-
|
|
228
|
+
- Gestures take a few seconds to react(https://github.com/iberianpig/fusuma/issues/113)
|
|
167
229
|
|
|
168
230
|
#### Alternatives to xdotool
|
|
169
231
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
232
|
+
- [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
|
|
233
|
+
|
|
234
|
+
- Emulates keyboard events
|
|
235
|
+
- Low latency
|
|
236
|
+
- Wayland compatible
|
|
173
237
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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.
|
|
177
246
|
|
|
178
247
|
## Options
|
|
179
248
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
+
```
|
|
186
267
|
|
|
187
268
|
## Autostart (gnome-session-properties)
|
|
269
|
+
|
|
188
270
|
1. Check the path where you installed fusuma with `$ which fusuma`
|
|
189
271
|
2. Open `$ gnome-session-properties`
|
|
190
272
|
3. Add Fusuma and enter the location where the above path was checked in the command input field
|
|
@@ -194,9 +276,9 @@ swipe:
|
|
|
194
276
|
|
|
195
277
|
Following features are provided as plugins.
|
|
196
278
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
279
|
+
- Adding new gestures or combinations
|
|
280
|
+
- Features for specific Linux distributions
|
|
281
|
+
- Setting different gestures per applications
|
|
200
282
|
|
|
201
283
|
### Installation of fusuma plugins
|
|
202
284
|
|
|
@@ -207,7 +289,7 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
|
|
|
207
289
|
### Available plugins
|
|
208
290
|
|
|
209
291
|
| Name | About |
|
|
210
|
-
|
|
292
|
+
| ------------------------------------------------------------------------------ | --------------------------------------------- |
|
|
211
293
|
| [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | Emulates keyboard events |
|
|
212
294
|
| [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | Manages Window and Workspace |
|
|
213
295
|
| [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | Detects gestures while pressing multiple keys |
|
|
@@ -215,9 +297,8 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
|
|
|
215
297
|
|
|
216
298
|
## Tutorial Video
|
|
217
299
|
|
|
218
|
-
[](http://www.youtube.com/watch?v=bn11Iwvf29I "Multitouch Touchpad Gestures in Linux with Fusuma")
|
|
219
|
-
[Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
|
|
220
|
-
|
|
300
|
+
[](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)
|
|
221
302
|
|
|
222
303
|
## Support
|
|
223
304
|
|
|
@@ -225,16 +306,13 @@ I'm a Freelance Engineer in Japan and working on these products after finishing
|
|
|
225
306
|
Currently, my open-source contribution times is not enough.
|
|
226
307
|
If you like my work and want to contribute and become a sponsor, I will be able to focus on my projects.
|
|
227
308
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
309
|
+
- [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
|
|
310
|
+
- [Patreon](https://www.patreon.com/iberianpig)
|
|
231
311
|
|
|
232
312
|
## Contributing
|
|
233
313
|
|
|
234
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.
|
|
235
315
|
|
|
236
|
-
|
|
237
316
|
## License
|
|
238
317
|
|
|
239
318
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
240
|
-
|
data/bin/console
CHANGED
|
@@ -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
data/fusuma.gemspec
CHANGED
|
@@ -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§ion=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'
|
data/lib/fusuma.rb
CHANGED
|
@@ -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
|
|
@@ -33,43 +33,21 @@ module Fusuma
|
|
|
33
33
|
|
|
34
34
|
Plugin::Manager.require_base_plugins
|
|
35
35
|
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
46
|
|
|
65
|
-
|
|
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)
|
|
71
|
-
return unless config_path
|
|
72
|
-
|
|
73
51
|
Config.custom_path = config_path
|
|
74
52
|
end
|
|
75
53
|
end
|
|
@@ -86,7 +64,7 @@ module Fusuma
|
|
|
86
64
|
def run
|
|
87
65
|
# TODO: run with multi thread
|
|
88
66
|
@inputs.first.run do |event|
|
|
89
|
-
|
|
67
|
+
clear_expired_events
|
|
90
68
|
filtered = filter(event) || next
|
|
91
69
|
parsed = parse(filtered) || next
|
|
92
70
|
buffered = buffer(parsed) || next
|
|
@@ -139,7 +117,7 @@ module Fusuma
|
|
|
139
117
|
executor&.execute(event)
|
|
140
118
|
end
|
|
141
119
|
|
|
142
|
-
def
|
|
120
|
+
def clear_expired_events
|
|
143
121
|
@buffers.each(&:clear_expired)
|
|
144
122
|
end
|
|
145
123
|
end
|
data/lib/fusuma/config.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative './multi_logger.rb'
|
|
4
4
|
require_relative './config/index.rb'
|
|
5
|
+
require_relative './config/yaml_duplication_checker.rb'
|
|
5
6
|
require 'singleton'
|
|
6
7
|
require 'yaml'
|
|
7
8
|
|
|
@@ -9,6 +10,9 @@ require 'yaml'
|
|
|
9
10
|
module Fusuma
|
|
10
11
|
# read keymap from yaml file
|
|
11
12
|
class Config
|
|
13
|
+
class NotFoundError < StandardError; end
|
|
14
|
+
class InvalidFileError < StandardError; end
|
|
15
|
+
|
|
12
16
|
include Singleton
|
|
13
17
|
|
|
14
18
|
class << self
|
|
@@ -28,7 +32,6 @@ module Fusuma
|
|
|
28
32
|
@custom_path = nil
|
|
29
33
|
@cache = nil
|
|
30
34
|
@keymap = nil
|
|
31
|
-
reload
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
def custom_path=(new_path)
|
|
@@ -37,12 +40,33 @@ module Fusuma
|
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
def reload
|
|
40
|
-
@cache
|
|
41
|
-
|
|
42
|
-
MultiLogger.info "reload config
|
|
43
|
+
@cache = nil
|
|
44
|
+
path = find_filepath
|
|
45
|
+
MultiLogger.info "reload config: #{path}"
|
|
46
|
+
@keymap = validate(path)
|
|
43
47
|
self
|
|
44
48
|
end
|
|
45
49
|
|
|
50
|
+
# @return [Hash]
|
|
51
|
+
# @raise [InvalidError]
|
|
52
|
+
def validate(path)
|
|
53
|
+
duplicates = []
|
|
54
|
+
YAMLDuplicationChecker.check(File.read(path), path) do |ignored, duplicate|
|
|
55
|
+
MultiLogger.error "#{path}: #{ignored.value} is duplicated"
|
|
56
|
+
duplicates << duplicate.value
|
|
57
|
+
end
|
|
58
|
+
raise InvalidFileError, "Detect duplicate keys #{duplicates}" unless duplicates.empty?
|
|
59
|
+
|
|
60
|
+
yaml = YAML.load_file(path)
|
|
61
|
+
|
|
62
|
+
raise InvalidFileError, 'Invaid YAML file' unless yaml.is_a? Hash
|
|
63
|
+
|
|
64
|
+
yaml.deep_symbolize_keys
|
|
65
|
+
rescue StandardError => e
|
|
66
|
+
MultiLogger.error e.message
|
|
67
|
+
raise InvalidFileError, e.message
|
|
68
|
+
end
|
|
69
|
+
|
|
46
70
|
# @param index [Index]
|
|
47
71
|
def search(index)
|
|
48
72
|
cache(index.cache_key) do
|
|
@@ -64,13 +88,16 @@ module Fusuma
|
|
|
64
88
|
|
|
65
89
|
private
|
|
66
90
|
|
|
67
|
-
def
|
|
91
|
+
def find_filepath
|
|
68
92
|
filename = 'fusuma/config.yml'
|
|
69
|
-
if custom_path
|
|
70
|
-
expand_custom_path
|
|
93
|
+
if custom_path
|
|
94
|
+
return expand_custom_path if File.exist?(expand_custom_path)
|
|
95
|
+
|
|
96
|
+
raise NotFoundError, "#{expand_custom_path} is NOT FOUND"
|
|
71
97
|
elsif File.exist?(expand_config_path(filename))
|
|
72
98
|
expand_config_path(filename)
|
|
73
99
|
else
|
|
100
|
+
MultiLogger.warn "config file: #{expand_config_path(filename)} is NOT FOUND"
|
|
74
101
|
expand_default_path(filename)
|
|
75
102
|
end
|
|
76
103
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fusuma
|
|
4
|
+
class Config
|
|
5
|
+
# ref: https://github.com/rubocop-hq/rubocop/blob/97e4ffc8a71e9e5239a927c6a534dfc1e0da917f/lib/rubocop/yaml_duplication_checker.rb
|
|
6
|
+
# Find duplicated keys from YAML.
|
|
7
|
+
module YAMLDuplicationChecker
|
|
8
|
+
def self.check(yaml_string, filename, &on_duplicated)
|
|
9
|
+
# Ruby 2.6+
|
|
10
|
+
tree = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0')
|
|
11
|
+
# Specify filename to display helpful message when it raises
|
|
12
|
+
# an error.
|
|
13
|
+
YAML.parse(yaml_string, filename: filename)
|
|
14
|
+
else
|
|
15
|
+
YAML.parse(yaml_string, filename)
|
|
16
|
+
end
|
|
17
|
+
return unless tree
|
|
18
|
+
|
|
19
|
+
traverse(tree, &on_duplicated)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.traverse(tree, &on_duplicated)
|
|
23
|
+
case tree
|
|
24
|
+
when Psych::Nodes::Mapping
|
|
25
|
+
tree.children.each_slice(2).with_object([]) do |(key, value), keys|
|
|
26
|
+
exist = keys.find { |key2| key2.value == key.value }
|
|
27
|
+
on_duplicated.call(exist, key) if exist
|
|
28
|
+
keys << key
|
|
29
|
+
traverse(value, &on_duplicated)
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
children = tree.children
|
|
33
|
+
return unless children
|
|
34
|
+
|
|
35
|
+
children.each { |c| traverse(c, &on_duplicated) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private_class_method :traverse
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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(
|
|
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
|
data/lib/fusuma/version.rb
CHANGED
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.
|
|
4
|
+
version: 1.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- iberianpig
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-27 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
|
|
@@ -184,7 +200,9 @@ files:
|
|
|
184
200
|
- lib/fusuma/config.rb
|
|
185
201
|
- lib/fusuma/config.yml
|
|
186
202
|
- lib/fusuma/config/index.rb
|
|
203
|
+
- lib/fusuma/config/yaml_duplication_checker.rb
|
|
187
204
|
- lib/fusuma/device.rb
|
|
205
|
+
- lib/fusuma/environment.rb
|
|
188
206
|
- lib/fusuma/libinput_command.rb
|
|
189
207
|
- lib/fusuma/multi_logger.rb
|
|
190
208
|
- lib/fusuma/plugin/base.rb
|
|
@@ -203,6 +221,7 @@ files:
|
|
|
203
221
|
- lib/fusuma/plugin/executors/executor.rb
|
|
204
222
|
- lib/fusuma/plugin/filters/filter.rb
|
|
205
223
|
- lib/fusuma/plugin/filters/libinput_device_filter.rb
|
|
224
|
+
- lib/fusuma/plugin/filters/libinput_timeout_filter.rb
|
|
206
225
|
- lib/fusuma/plugin/inputs/input.rb
|
|
207
226
|
- lib/fusuma/plugin/inputs/libinput_command_input.rb
|
|
208
227
|
- lib/fusuma/plugin/manager.rb
|
|
@@ -229,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
229
248
|
- !ruby/object:Gem::Version
|
|
230
249
|
version: '0'
|
|
231
250
|
requirements: []
|
|
232
|
-
rubygems_version: 3.1
|
|
251
|
+
rubygems_version: 3.2.0.rc.1
|
|
233
252
|
signing_key:
|
|
234
253
|
specification_version: 4
|
|
235
254
|
summary: Multitouch gestures with libinput dirver on X11, Linux
|