fusuma-plugin-keypress 0.1.1 → 0.4.0.pre2

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: ba7624b5d5749ace3e2c6238292d7b6ef2ab0f5a65735e50b1aab2147c3e0370
4
- data.tar.gz: 297e7e5651be6a4ad278ed9aaac8523f09438a4e2c112d1e19ca8298ab459880
3
+ metadata.gz: 6e19797193a2845f13a7d0dc0bc5715cc0e71b4b31145624cbf1c105b6b6f835
4
+ data.tar.gz: 688e9f8d56606d1bcdbf687d21ec7c92258d9787a1ca739e435ec2846963d5d2
5
5
  SHA512:
6
- metadata.gz: 2a05884669bd2c4ccf652f24eefc816eceb530b99f5c588471fc885932c2d5ebb8b4634b6b7cc18a4f643fde839f4086d4192b1766d0eb7dfcddd94258f2ac60
7
- data.tar.gz: 8c15dde07405db86a17aa8adc7412b5450b617f4970487d1ecdbfb742d50b3ffd67d287d2a650632fa7f5ee425e4c82aad4f3a1aa45267b149f67bce8f67c31c
6
+ metadata.gz: a8775fac9db8bc5bf876826014b914cfb5e22b35e4d9a8a190aeb596b21beb8093e4e8c0c44b8fa6269eaffcfbe8275f24071bfc09282f3e451eb9ed8131d5c0
7
+ data.tar.gz: 8fd0a06993e60e0e215862d945e5ed4633a325b38956c9fcdc830e5d320112b19a443527b75b903a5565650e708b9c6777def3cd42fb027be474ee91e3bb2e2e
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,3 +1,7 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ NewCops: enable
4
+
1
5
  Metrics/ModuleLength:
2
6
  Exclude:
3
7
  - "**/*_spec.rb"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
- # Change Log
1
+ # Changelog
2
2
 
3
+ ## [v0.4.0.pre](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.4.0.pre) (2020-11-09)
3
4
 
5
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.3.0...v0.4.0.pre)
4
6
 
5
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
7
+ ## [v0.3.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.3.0) (2020-11-09)
8
+
9
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.2.1...v0.3.0)
10
+
11
+ ## [v0.2.1](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.2.1) (2020-04-15)
12
+
13
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.2.0...v0.2.1)
14
+
15
+ **Closed issues:**
16
+
17
+ - Only 'LEFTMETA' keycode works on KDE Plasma [\#2](https://github.com/iberianpig/fusuma-plugin-keypress/issues/2)
18
+
19
+ ## [v0.2.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.2.0) (2020-03-18)
20
+
21
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.1...v0.2.0)
22
+
23
+ **Closed issues:**
24
+
25
+ - Trigger a command multiple times while keeping the key pressed [\#1](https://github.com/iberianpig/fusuma-plugin-keypress/issues/1)
26
+
27
+ ## [v0.1.1](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.1) (2020-02-18)
28
+
29
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.0...v0.1.1)
30
+
31
+ ## [v0.1.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.0) (2019-11-12)
32
+
33
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/fb8d8ccfc3828e487607706335f670ae5392f08d...v0.1.0)
34
+
35
+
36
+
37
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -4,3 +4,15 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in fusuma-plugin-keypress.gemspec
6
6
  gemspec
7
+
8
+ gem 'bundler'
9
+ gem 'github_changelog_generator'
10
+ gem 'lefthook'
11
+ gem 'pry-byebug', '~> 3.4'
12
+ gem 'pry-doc'
13
+ gem 'pry-inline'
14
+ gem 'rake', '~> 13.0'
15
+ gem 'reek'
16
+ gem 'rspec', '~> 3.0'
17
+ gem 'rubocop'
18
+ gem 'yard'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Fusuma::Plugin::Keypress [![Gem Version](https://badge.fury.io/rb/fusuma-plugin-keypress.svg)](https://badge.fury.io/rb/fusuma-plugin-keypress) [![Build Status](https://travis-ci.com/iberianpig/fusuma-plugin-keypress.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma-plugin-keypress)
2
2
 
3
3
 
4
- Keypress combination plugin for [Fusuma](https://github.com/iberianpig/fusuma)
4
+ Keyboard + Touchpad combination plugin for [Fusuma](https://github.com/iberianpig/fusuma)
5
5
 
6
6
  * Customize gestures with modifier keys
7
7
  * Supports multiple modifier key combinations
@@ -10,38 +10,33 @@ Keypress combination plugin for [Fusuma](https://github.com/iberianpig/fusuma)
10
10
 
11
11
  Run the following code in your terminal.
12
12
 
13
- ### Install libinput-tools
14
-
15
- ```sh
16
- $ sudo apt-get install libinput-tools
17
- ```
18
-
19
13
  ### Install fusuma-plugin-keypress
20
14
 
21
- This plugin requires [Fusuma](https://github.com/iberianpig/fusuma#update) version 1.3 or later.
15
+ This plugin requires [Fusuma](https://github.com/iberianpig/fusuma#update) version 1.4 or later.
22
16
 
23
17
  ```sh
24
- $ gem install fusuma-plugin-keypress
18
+ $ sudo gem install fusuma-plugin-keypress
25
19
  ```
26
20
 
27
- ### Add show-keycode option
21
+ ### Add show-keycodes option
28
22
 
29
23
  Open `~/.config/fusuma/config.yml` and add the following code at the bottom.
30
24
 
31
25
  ```yaml
32
- plugin:
26
+ plugin:
33
27
  inputs:
34
28
  libinput_command_input:
35
- show-keycode: true
29
+ show-keycodes: true
36
30
  ```
37
31
 
38
- **NOTE: fusuma can read your keyboard inputs if show-keycode option is true**
32
+ **NOTE: fusuma can read your keyboard inputs if show-keycodes option is true**
39
33
 
40
34
  ## Properties
41
35
 
42
36
  Add `keypress:` property in `~/.config/fusuma/config.yml`.
43
37
 
44
38
  Keys following are available for `keypress`.
39
+
45
40
  * `CAPSLOCK`
46
41
  * `LEFTALT`
47
42
  * `LEFTCTRL`
@@ -50,6 +45,7 @@ Keys following are available for `keypress`.
50
45
  * `RIGHTALT`
51
46
  * `RIGHTCTRL`
52
47
  * `RIGHTSHIFT`
48
+ * `RIGHTMETA`
53
49
 
54
50
  ## Example
55
51
 
@@ -74,15 +70,15 @@ swipe:
74
70
  LEFTMETA+LEFTALT:
75
71
  command: 'xdotool key --clearmodifiers XF86AudioLowerVolume'
76
72
 
77
- plugin:
73
+ plugin:
78
74
  inputs:
79
75
  libinput_command_input:
80
- show-keycode: true
76
+ show-keycodes: true
81
77
  ```
82
78
 
83
79
  * Swipe up/down with four fingers while keypress LEFTMETA key to change display brightnes .
84
80
  * Swipe up/down with four fingers while keypress LEFTMETA and LEFTALT keys to change audio volume.
85
- - If you want to combine a gesture with two keys, combine modifier keys with `+`
81
+ - If you want to combine a gesture with two keys, combine modifier keys with `+`
86
82
 
87
83
  ## Contributing
88
84
 
@@ -24,17 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.required_ruby_version = '>= 2.3' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all&section=main
28
- spec.add_dependency 'fusuma', '~> 1.4'
29
-
30
- spec.add_development_dependency 'bundler'
31
- spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
32
- spec.add_development_dependency 'pry-byebug', '~> 3.4'
33
- spec.add_development_dependency 'pry-doc'
34
- spec.add_development_dependency 'pry-inline'
35
- spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'reek'
37
- spec.add_development_dependency 'rspec', '~> 3.0'
38
- spec.add_development_dependency 'rubocop'
39
- spec.add_development_dependency 'yard'
27
+ spec.required_ruby_version = '>= 2.4' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all&section=main
28
+ spec.add_dependency 'fusuma', '~> 2.0.0.pre2'
40
29
  end
data/lefthook.yml ADDED
@@ -0,0 +1,29 @@
1
+ # EXAMPLE USAGE
2
+ # Refer for explanation to following link:
3
+ # https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
4
+
5
+ # pre-push:
6
+ # commands:
7
+ # packages-audit:
8
+ # tags: frontend security
9
+ # run: yarn audit
10
+ # gems-audit:
11
+ # tags: backend security
12
+ # run: bundle audit
13
+
14
+ pre-commit:
15
+ parallel: true
16
+ commands:
17
+ # eslint:
18
+ # glob: "*.{js,ts}"
19
+ # run: yarn eslint {staged_files}
20
+ rubocop:
21
+ tags: backend style
22
+ glob: "*.rb"
23
+ # exclude: "application.rb|routes.rb"
24
+ run: bundle exec rubocop --force-exclusion {staged_files}
25
+ # scripts:
26
+ # "hello.js":
27
+ # runner: node
28
+ # "any.go":
29
+ # runner: go run
@@ -12,7 +12,15 @@ module Fusuma
12
12
  return if event&.tag != source
13
13
 
14
14
  @events.push(event)
15
- @events.clear if released?
15
+ end
16
+
17
+ def clear_expired(*)
18
+ return if @events.empty?
19
+
20
+ return unless released?
21
+
22
+ released_code = @events.last.record.code
23
+ @events.delete_if { |e| e.record.code == released_code }
16
24
  end
17
25
 
18
26
  def empty?
@@ -5,8 +5,14 @@ module Fusuma
5
5
  module Detectors
6
6
  # Detect KeypressEvent from KeypressBuffer
7
7
  class KeypressDetector < Detector
8
+ SOURCES = ['keypress'].freeze
8
9
  BUFFER_TYPE = 'keypress'
9
10
 
11
+ # Always watch buffers and detect them.
12
+ def watch?
13
+ true
14
+ end
15
+
10
16
  # @param buffers [Array<Event>]
11
17
  # @return [Event] if event is detected
12
18
  # @return [NilClass] if event is NOT detected
@@ -15,14 +21,13 @@ module Fusuma
15
21
 
16
22
  return if buffer.empty?
17
23
 
18
- records = buffer.events.map(&:record)
19
-
20
- index = create_index(records: records)
24
+ records = buffer.events.select { |e| e.record.status == 'pressed' }.map(&:record)
21
25
 
22
26
  index_record = Events::Records::IndexRecord.new(
23
- index: index,
27
+ index: create_index(records: records),
24
28
  position: :surfix
25
29
  )
30
+
26
31
  create_event(record: index_record)
27
32
  end
28
33
 
@@ -3,8 +3,8 @@
3
3
  # fusuma will `require fusuma-plugin-xxxx/plugin/xxxx.rb`
4
4
 
5
5
  require_relative './keypress/version'
6
- require_relative './events/records/keypress_record.rb'
7
- require_relative './filters/keypress_filter.rb'
8
- require_relative './parsers/keypress_parser.rb'
9
- require_relative './buffers/keypress_buffer.rb'
10
- require_relative './detectors/keypress_detector.rb'
6
+ require_relative './events/records/keypress_record'
7
+ require_relative './filters/keypress_filter'
8
+ require_relative './parsers/keypress_parser'
9
+ require_relative './buffers/keypress_buffer'
10
+ require_relative './detectors/keypress_detector'
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Keypress
6
- VERSION = '0.1.1'
6
+ VERSION = '0.4.0.pre2'
7
7
  end
8
8
  end
9
9
  end
@@ -7,6 +7,18 @@ module Fusuma
7
7
  class KeypressParser < Parser
8
8
  DEFAULT_SOURCE = 'libinput_command_input'
9
9
 
10
+ AVAILABLE_KEYS = %w[
11
+ CAPSLOCK
12
+ LEFTALT
13
+ LEFTCTRL
14
+ LEFTMETA
15
+ LEFTSHIFT
16
+ RIGHTALT
17
+ RIGHTCTRL
18
+ RIGHTSHIFT
19
+ RIGHTMETA
20
+ ].freeze
21
+
10
22
  # @param record [String]
11
23
  # @return [Records::Gesture, nil]
12
24
  def parse_record(record)
@@ -27,6 +39,8 @@ module Fusuma
27
39
  code = matched[2] # LEFTSHIFT
28
40
  status = matched[3] # pressed
29
41
 
42
+ return unless AVAILABLE_KEYS.include?(code)
43
+
30
44
  Events::Records::KeypressRecord.new(status: status, code: code)
31
45
  end
32
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma-plugin-keypress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.4.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusuma
@@ -16,154 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: 2.0.0.pre2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.4'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
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'
41
- - !ruby/object:Gem::Dependency
42
- name: github_changelog_generator
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.14'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.14'
55
- - !ruby/object:Gem::Dependency
56
- name: pry-byebug
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.4'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.4'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-doc
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry-inline
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '13.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '13.0'
111
- - !ruby/object:Gem::Dependency
112
- name: reek
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: yard
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
26
+ version: 2.0.0.pre2
167
27
  description: fusuma-plugin-keypress is Fusuma plugin for keypress combination.
168
28
  email:
169
29
  - yhkyky@gmail.com
@@ -183,6 +43,7 @@ files:
183
43
  - bin/console
184
44
  - bin/setup
185
45
  - fusuma-plugin-keypress.gemspec
46
+ - lefthook.yml
186
47
  - lib/fusuma/plugin/buffers/keypress_buffer.rb
187
48
  - lib/fusuma/plugin/detectors/keypress_detector.rb
188
49
  - lib/fusuma/plugin/events/records/keypress_record.rb
@@ -194,7 +55,7 @@ homepage: https://github.com/iberianpig/fusuma-plugin-keypress
194
55
  licenses:
195
56
  - MIT
196
57
  metadata: {}
197
- post_install_message:
58
+ post_install_message:
198
59
  rdoc_options: []
199
60
  require_paths:
200
61
  - lib
@@ -202,15 +63,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
63
  requirements:
203
64
  - - ">="
204
65
  - !ruby/object:Gem::Version
205
- version: '2.3'
66
+ version: '2.4'
206
67
  required_rubygems_version: !ruby/object:Gem::Requirement
207
68
  requirements:
208
- - - ">="
69
+ - - ">"
209
70
  - !ruby/object:Gem::Version
210
- version: '0'
71
+ version: 1.3.1
211
72
  requirements: []
212
- rubygems_version: 3.0.3
213
- signing_key:
73
+ rubygems_version: 3.1.4
74
+ signing_key:
214
75
  specification_version: 4
215
76
  summary: Keypress plugin for Fusuma
216
77
  test_files: []