fusuma 1.10.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +9 -0
  3. data/.rubocop.yml +27 -0
  4. data/.rubocop_todo.yml +34 -19
  5. data/.solargraph.yml +16 -0
  6. data/.travis.yml +1 -3
  7. data/CHANGELOG.md +38 -1
  8. data/CONTRIBUTING.md +72 -0
  9. data/Gemfile +17 -0
  10. data/README.md +53 -7
  11. data/fusuma.gemspec +4 -13
  12. data/lib/fusuma.rb +91 -29
  13. data/lib/fusuma/config.rb +59 -60
  14. data/lib/fusuma/config/index.rb +39 -6
  15. data/lib/fusuma/config/searcher.rb +166 -0
  16. data/lib/fusuma/config/yaml_duplication_checker.rb +42 -0
  17. data/lib/fusuma/custom_process.rb +13 -0
  18. data/lib/fusuma/device.rb +22 -7
  19. data/lib/fusuma/environment.rb +6 -4
  20. data/lib/fusuma/hash_support.rb +40 -0
  21. data/lib/fusuma/libinput_command.rb +17 -21
  22. data/lib/fusuma/multi_logger.rb +2 -6
  23. data/lib/fusuma/plugin/base.rb +18 -15
  24. data/lib/fusuma/plugin/buffers/buffer.rb +3 -2
  25. data/lib/fusuma/plugin/buffers/gesture_buffer.rb +34 -25
  26. data/lib/fusuma/plugin/buffers/timer_buffer.rb +46 -0
  27. data/lib/fusuma/plugin/detectors/detector.rb +26 -5
  28. data/lib/fusuma/plugin/detectors/pinch_detector.rb +109 -58
  29. data/lib/fusuma/plugin/detectors/rotate_detector.rb +91 -50
  30. data/lib/fusuma/plugin/detectors/swipe_detector.rb +93 -56
  31. data/lib/fusuma/plugin/events/event.rb +5 -4
  32. data/lib/fusuma/plugin/events/records/context_record.rb +27 -0
  33. data/lib/fusuma/plugin/events/records/gesture_record.rb +9 -6
  34. data/lib/fusuma/plugin/events/records/index_record.rb +46 -14
  35. data/lib/fusuma/plugin/events/records/record.rb +1 -1
  36. data/lib/fusuma/plugin/events/records/text_record.rb +2 -1
  37. data/lib/fusuma/plugin/executors/command_executor.rb +21 -6
  38. data/lib/fusuma/plugin/executors/executor.rb +45 -3
  39. data/lib/fusuma/plugin/filters/filter.rb +1 -1
  40. data/lib/fusuma/plugin/filters/libinput_device_filter.rb +6 -7
  41. data/lib/fusuma/plugin/filters/libinput_timeout_filter.rb +2 -2
  42. data/lib/fusuma/plugin/inputs/input.rb +64 -8
  43. data/lib/fusuma/plugin/inputs/libinput_command_input.rb +19 -9
  44. data/lib/fusuma/plugin/inputs/timer_input.rb +63 -0
  45. data/lib/fusuma/plugin/manager.rb +22 -29
  46. data/lib/fusuma/plugin/parsers/libinput_gesture_parser.rb +10 -8
  47. data/lib/fusuma/plugin/parsers/parser.rb +8 -9
  48. data/lib/fusuma/string_support.rb +16 -0
  49. data/lib/fusuma/version.rb +1 -1
  50. metadata +21 -150
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9d6954579a300b089bb94a20b3c03b6d2f9729f208af6082b8b5963dd9608e0
4
- data.tar.gz: 8a62c074532cdf4e032d1c9c625f1bdf3f42eff7b8f1bdb1ee18ac9168f5c991
3
+ metadata.gz: c8b830de9940632862b66b2cd6dbd6cf9ead713a24d7913d31baae7baacef348
4
+ data.tar.gz: e55c53522a2184c8e6197bc12c4ca203cd844f1277dafbfe02fde48ae8f0d8c6
5
5
  SHA512:
6
- metadata.gz: 1d9379023929b19716783509127caaa4f1ffc6951a5951c5a866a0842a6d2f97bf6fbe6e5a83d43a7d0b0bead2fb87324f7a5bfcee8aae60fe1eb7f4265b55d2
7
- data.tar.gz: a2aeca01b913ab48f130069de6e2cbce63d4dadabf2cebb7deb81018e584f4993246801cec770a5a1fb87b4d3d83709ad4079c6400edbabd5ce6e38abedef998
6
+ metadata.gz: 8153cf247654a3b70f976f74b0c3d791a962185fec288286f625448e8c23c6b53e134acff8d2ebad51eebdd51fefe8539a8da11c5abbd7744b90f6f943b3316e
7
+ data.tar.gz: 5065d471bfa721b9e973ac276ffb60db09ed1a5e4f967fa8dd7010856d6709b9c44ea3b9cd5fab82c2b2ae2467a0b072f14a3c779db331abbcda1b9fa479a276
@@ -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
@@ -1,5 +1,9 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: '2.5'
5
+ NewCops: enable
6
+
3
7
  Metrics/ModuleLength:
4
8
  Exclude:
5
9
  - "**/*_spec.rb"
@@ -14,3 +18,26 @@ Layout/LineLength:
14
18
  Exclude:
15
19
  - "fusuma.gemspec"
16
20
  - "**/*_spec.rb"
21
+
22
+ # For rubocop < 1.0.0
23
+ Style/HashEachMethods:
24
+ Enabled: true
25
+
26
+ # For rubocop < 1.0.0
27
+ Style/HashTransformKeys:
28
+ Enabled: true
29
+
30
+ # For rubocop < 1.0.0
31
+ Style/HashTransformValues:
32
+ Enabled: true
33
+
34
+ Lint/RaiseException:
35
+ Enabled: true
36
+ Lint/StructNewOverride:
37
+ Enabled: true
38
+
39
+ # for declaring dummy classes in ./spec
40
+ Lint/ConstantDefinitionInBlock:
41
+ Exclude:
42
+ - "**/*_spec.rb"
43
+
data/.rubocop_todo.yml CHANGED
@@ -1,24 +1,49 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-01-07 13:21:56 +0900 using RuboCop version 0.78.0.
3
+ # on 2021-03-28 13:34:27 UTC using RuboCop version 1.10.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 5
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
12
+ # URISchemes: http, https
13
+ Layout/LineLength:
14
+ Max: 104
15
+
16
+ # Offense count: 9
17
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
10
18
  Metrics/AbcSize:
11
- Max: 25
19
+ Max: 67
12
20
 
13
- # Offense count: 1
14
- # Configuration parameters: CountComments.
21
+ # Offense count: 2
22
+ # Configuration parameters: CountComments, CountAsOne.
15
23
  Metrics/ClassLength:
16
- Max: 101
24
+ Max: 121
17
25
 
18
- # Offense count: 8
19
- # Configuration parameters: CountComments, ExcludedMethods.
26
+ # Offense count: 7
27
+ # Configuration parameters: IgnoredMethods.
28
+ Metrics/CyclomaticComplexity:
29
+ Max: 12
30
+
31
+ # Offense count: 24
32
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
20
33
  Metrics/MethodLength:
21
- Max: 15
34
+ Max: 57
35
+
36
+ # Offense count: 5
37
+ # Configuration parameters: IgnoredMethods.
38
+ Metrics/PerceivedComplexity:
39
+ Max: 13
40
+
41
+ # Offense count: 1
42
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
43
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
44
+ Naming/MemoizedInstanceVariableName:
45
+ Exclude:
46
+ - 'lib/fusuma/plugin/detectors/detector.rb'
22
47
 
23
48
  # Offense count: 3
24
49
  Style/Documentation:
@@ -28,13 +53,3 @@ Style/Documentation:
28
53
  - 'lib/fusuma/plugin/detectors/pinch_detector.rb'
29
54
  - 'lib/fusuma/plugin/detectors/rotate_detector.rb'
30
55
  - 'lib/fusuma/plugin/detectors/swipe_detector.rb'
31
-
32
- # Offense count: 3
33
- # Cop supports --auto-correct.
34
- # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
35
- # SupportedStyles: predicate, comparison
36
- Style/NumericPredicate:
37
- Exclude:
38
- - 'spec/**/*'
39
- - 'lib/fusuma/plugin/detectors/rotate_detector.rb'
40
- - 'lib/fusuma/plugin/detectors/swipe_detector.rb'
data/.solargraph.yml ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - rubocop
13
+ # - require_not_found
14
+ require_paths: []
15
+ plugins: []
16
+ max_files: 5000
data/.travis.yml CHANGED
@@ -3,9 +3,7 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.3.1
7
- - 2.4
8
- - 2.5
6
+ - 2.5.1
9
7
  - 2.6
10
8
  - 2.7
11
9
  before_install: gem install bundler --no-document -v 2.0.1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.11.0](https://github.com/iberianpig/fusuma/tree/v1.11.0) (2020-07-25)
4
+
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
+
3
40
  ## [v1.10.0](https://github.com/iberianpig/fusuma/tree/v1.10.0) (2020-05-04)
4
41
 
5
42
  [Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.9.0...v1.10.0)
@@ -210,7 +247,7 @@
210
247
 
211
248
  **Closed issues:**
212
249
 
213
- - Print system information for debuging [\#70](https://github.com/iberianpig/fusuma/issues/70)
250
+ - Print system information for debugging [\#70](https://github.com/iberianpig/fusuma/issues/70)
214
251
  - rescue from SIGINT Interruption with Ctrl-C [\#64](https://github.com/iberianpig/fusuma/issues/64)
215
252
 
216
253
  ## [v0.7.1](https://github.com/iberianpig/fusuma/tree/v0.7.1) (2018-06-01)
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/Gemfile CHANGED
@@ -4,3 +4,20 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in fusuma.gemspec
6
6
  gemspec
7
+
8
+ gem 'bundler'
9
+ gem 'coveralls'
10
+ gem 'github_changelog_generator', '~> 1.14'
11
+ gem 'pry-byebug', '~> 3.4'
12
+ gem 'pry-doc'
13
+ gem 'pry-inline'
14
+ gem 'rake', '~> 13.0'
15
+ gem 'rblineprof'
16
+ gem 'rblineprof-report'
17
+ gem 'reek'
18
+ gem 'rspec', '~> 3.0'
19
+ gem 'rubocop'
20
+ gem 'rubocop-rake'
21
+ gem 'rubocop-rspec'
22
+ gem 'solargraph'
23
+ gem 'yard'
data/README.md CHANGED
@@ -17,7 +17,7 @@ This gem makes your linux able to recognize swipes or pinchs and assign commands
17
17
 
18
18
  ## Installation
19
19
 
20
- ### 1. Grant permission to read the touchpad device
20
+ ### Grant permission to read the touchpad device
21
21
 
22
22
  **IMPORTANT**: You **MUST** be a member of the **INPUT** group to read touchpad by Fusuma.
23
23
 
@@ -25,9 +25,15 @@ This gem makes your linux able to recognize swipes or pinchs and assign commands
25
25
  $ sudo gpasswd -a $USER input
26
26
  ```
27
27
 
28
- Then, You **MUST** **REBOOT** to assign this group.
28
+ Then, You apply the change with no logout or reboot.
29
29
 
30
- ### 2. Install libinput-tools
30
+ ```bash
31
+ $ newgrp input
32
+ ```
33
+
34
+ ### For Debian Based Distros (Ubuntu, Debian, Mint, Pop!OS)
35
+
36
+ #### 1. Install libinput-tools
31
37
 
32
38
  You need `libinput` release 1.0 or later.
33
39
 
@@ -35,7 +41,7 @@ You need `libinput` release 1.0 or later.
35
41
  $ sudo apt-get install libinput-tools
36
42
  ```
37
43
 
38
- ### 3. Install Ruby
44
+ #### 2. Install Ruby
39
45
 
40
46
  Fusuma runs in Ruby, so you must install it first.
41
47
 
@@ -43,13 +49,13 @@ Fusuma runs in Ruby, so you must install it first.
43
49
  $ sudo apt-get install ruby
44
50
  ```
45
51
 
46
- ### 4. Install Fusuma
52
+ #### 3. Install Fusuma
47
53
 
48
54
  ```bash
49
55
  $ sudo gem install fusuma
50
56
  ```
51
57
 
52
- ### 5. Install xdotool (optional)
58
+ #### 4. Install xdotool (optional)
53
59
 
54
60
  For sending shortcuts:
55
61
 
@@ -57,6 +63,42 @@ For sending shortcuts:
57
63
  $ sudo apt-get install xdotool
58
64
  ```
59
65
 
66
+ ### For Arch Based Distros (Manjaro, Arch)
67
+
68
+ #### 1. Install libinput.
69
+
70
+ You need `libinput` release 1.0 or later. This is most probably installed by default on Manjaro
71
+
72
+ ```z-h
73
+ $ sudo pacman -S libinput
74
+ ```
75
+
76
+ #### 2. Install Ruby
77
+
78
+ Fusuma runs in Ruby, so you must install it first.
79
+
80
+ ```zsh
81
+ $ sudo pacman -S ruby
82
+ ```
83
+
84
+ #### 3. Install Fusuma
85
+
86
+ **Note:** By default in Arch Linux, when running ```gem```, gems are installed per-user (into ```~/.gem/ruby/```), instead of system-wide (into ```/usr/lib/ruby/gems/```). This is considered the best way to manage gems on Arch, because otherwise they might interfere with gems installed by Pacman. (From Arch Wiki)
87
+
88
+ To install gems system-wide, see any of the methods listed on [Arch Wiki](https://wiki.archlinux.org/index.php/ruby#Installing_gems_system-wide)
89
+
90
+ ```zsh
91
+ $ sudo gem install fusuma
92
+ ```
93
+
94
+ #### 4. Install xdotool (optional)
95
+
96
+ For sending shortcuts:
97
+
98
+ ```zsh
99
+ $ sudo pacman -S xdotool
100
+ ```
101
+
60
102
  ### Touchpad not working in GNOME
61
103
 
62
104
  Ensure the touchpad events are being sent to the GNOME desktop by running the following command:
@@ -181,7 +223,6 @@ pinch:
181
223
  2:
182
224
  in:
183
225
  command: "xdotool keydown ctrl click 4 keyup ctrl" # threshold: 0.5, interval: 0.5
184
- 2:
185
226
  out:
186
227
  command: "xdotool keydown ctrl click 5 keyup ctrl" # threshold: 0.5, interval: 0.5
187
228
 
@@ -239,6 +280,11 @@ swipe:
239
280
  - `xte`
240
281
  - [xte(1) - Linux man page](https://linux.die.net/man/1/xte)
241
282
  - install with `sudo apt xautomation`
283
+
284
+ - [ydotool](https://github.com/ReimuNotMoe/ydotool)
285
+ - Wayland compatible
286
+ - Needs more maintainers.
287
+ - Requires only replacing `xdotool` with `ydotool` in fusuma conf.
242
288
 
243
289
  ## Options
244
290
 
data/fusuma.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ['iberianpig']
11
11
  spec.email = ['yhkyky@gmail.com']
12
12
 
13
- spec.summary = 'Multitouch gestures with libinput dirver on X11, Linux'
13
+ spec.summary = 'Multitouch gestures with libinput driver, Linux'
14
14
  spec.description = 'Fusuma is multitouch gesture recognizer. This gem makes your touchpad on Linux able to recognize swipes or pinchs and assign command to them. Read installation on Github(https://github.com/iberianpig/fusuma#installation).'
15
15
  spec.homepage = 'https://github.com/iberianpig/fusuma'
16
16
  spec.license = 'MIT'
@@ -23,16 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
  spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
25
25
 
26
- spec.required_ruby_version = '>= 2.3' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all&section=main
27
- spec.add_development_dependency 'bundler'
28
- spec.add_development_dependency "coveralls"
29
- spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
30
- spec.add_development_dependency 'pry-byebug', '~> 3.4'
31
- spec.add_development_dependency 'pry-doc'
32
- spec.add_development_dependency 'pry-inline'
33
- spec.add_development_dependency 'rake', '~> 13.0'
34
- spec.add_development_dependency 'reek'
35
- spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'rubocop'
37
- spec.add_development_dependency 'yard'
26
+ spec.required_ruby_version = '>= 2.5.1' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all&section=main
27
+ # support bionic (18.04LTS) 2.5.1
28
+ spec.add_dependency 'posix-spawn'
38
29
  end