fusuma 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/CHANGELOG.md +14 -0
- data/lib/fusuma.rb +29 -27
- data/lib/fusuma/plugin/buffers/gesture_buffer.rb +0 -1
- data/lib/fusuma/plugin/events/records/gesture_record.rb +0 -4
- data/lib/fusuma/plugin/events/records/index_record.rb +4 -7
- data/lib/fusuma/plugin/filters/filter.rb +6 -9
- data/lib/fusuma/plugin/inputs/libinput_command_input.rb +10 -9
- data/lib/fusuma/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 548a968eabf08c31b6ed710a8cfcc698d8a4cbca97ce15b6f7850138957a9617
|
4
|
+
data.tar.gz: 7d282246f87f40834ea414cd694b945d56be4deb37f59f7f6802a1eb756d46cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0d7dc5649dcf6ee8bc8cb5cfd3ecb590196d64fbcf175b31fdfe402b9eb81ac76d01fcd37ce630af165fc1891005fdba9c93c46b04e3a97bb73e3d3ccccef14
|
7
|
+
data.tar.gz: 1109fa1abb0afdca1b3557debc7bf0d2f1dac945d72336f6f58864ffdfe7aa2cebf0f9687b1b7ad315fffae8b142a8d22686d5b806f3babbd0142f00121a897f
|
data/.travis.yml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
sudo: false
|
2
|
+
|
2
3
|
language: ruby
|
4
|
+
cache: bundler
|
3
5
|
rvm:
|
4
6
|
- 2.3.1
|
5
7
|
- 2.4
|
6
8
|
- 2.5
|
7
|
-
|
8
|
-
|
9
|
-
- travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
|
9
|
+
- 2.6
|
10
|
+
before_install: gem install bundler --no-document -v 2.0.1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.2.1](https://github.com/iberianpig/fusuma/tree/v1.2.1) (2019-10-19)
|
4
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.2...v1.2.1)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- Fusuma must be started after connecting bluetooth trackpad [\#125](https://github.com/iberianpig/fusuma/issues/125)
|
9
|
+
|
10
|
+
**Merged pull requests:**
|
11
|
+
|
12
|
+
- Reload Filter when new device is added [\#137](https://github.com/iberianpig/fusuma/pull/137) ([iberianpig](https://github.com/iberianpig))
|
13
|
+
|
14
|
+
## [v1.2](https://github.com/iberianpig/fusuma/tree/v1.2) (2019-10-13)
|
15
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.1...v1.2)
|
16
|
+
|
3
17
|
## [v1.1](https://github.com/iberianpig/fusuma/tree/v1.1) (2019-10-12)
|
4
18
|
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.0...v1.1)
|
5
19
|
|
data/lib/fusuma.rb
CHANGED
@@ -33,8 +33,9 @@ module Fusuma
|
|
33
33
|
Plugin::Manager.require_plugins_from_relative
|
34
34
|
Plugin::Manager.require_plugins_from_config
|
35
35
|
|
36
|
-
print_version
|
36
|
+
print_version
|
37
37
|
print_enabled_plugins
|
38
|
+
Kernel.exit(0) if option[:version]
|
38
39
|
|
39
40
|
print_device_list if option[:list]
|
40
41
|
# TODO: remove keep_device_from_option from command line options
|
@@ -42,8 +43,7 @@ module Fusuma
|
|
42
43
|
Process.daemon if option[:daemon]
|
43
44
|
end
|
44
45
|
|
45
|
-
|
46
|
-
def print_version(then_exit: false)
|
46
|
+
def print_version
|
47
47
|
MultiLogger.info '---------------------------------------------'
|
48
48
|
MultiLogger.info "Fusuma: #{Fusuma::VERSION}"
|
49
49
|
MultiLogger.info "libinput: #{Plugin::Inputs::LibinputCommandInput.new.version}"
|
@@ -51,17 +51,16 @@ module Fusuma
|
|
51
51
|
MultiLogger.info "Distribution: #{`cat /etc/issue`}".strip
|
52
52
|
MultiLogger.info "Desktop session: #{`echo $DESKTOP_SESSION`}".strip
|
53
53
|
MultiLogger.info '---------------------------------------------'
|
54
|
-
Kernel.exit(0) if then_exit
|
55
54
|
end
|
56
55
|
|
57
56
|
def print_enabled_plugins
|
58
|
-
MultiLogger.
|
59
|
-
MultiLogger.
|
57
|
+
MultiLogger.info '---------------------------------------------'
|
58
|
+
MultiLogger.info 'Enabled Plugins: '
|
60
59
|
Plugin::Manager.plugins
|
61
60
|
.reject { |k, _v| k.to_s =~ /Base/ }
|
62
61
|
.map { |_base, plugins| plugins.map { |plugin| " #{plugin}" } }
|
63
|
-
.flatten.sort.each { |name| MultiLogger.
|
64
|
-
MultiLogger.
|
62
|
+
.flatten.sort.each { |name| MultiLogger.info(name) }
|
63
|
+
MultiLogger.info '---------------------------------------------'
|
65
64
|
end
|
66
65
|
|
67
66
|
def print_device_list
|
@@ -74,11 +73,6 @@ module Fusuma
|
|
74
73
|
|
75
74
|
Config.custom_path = config_path
|
76
75
|
end
|
77
|
-
|
78
|
-
def debug_mode
|
79
|
-
MultiLogger.instance.debug_mode = true
|
80
|
-
print_version
|
81
|
-
end
|
82
76
|
end
|
83
77
|
|
84
78
|
def initialize
|
@@ -97,16 +91,17 @@ module Fusuma
|
|
97
91
|
parsed = parse(filtered)
|
98
92
|
buffered = buffer(parsed)
|
99
93
|
detected = detect(buffered)
|
100
|
-
|
94
|
+
merged = merge(detected)
|
95
|
+
execute(merged)
|
101
96
|
end
|
102
97
|
end
|
103
98
|
|
104
99
|
def filter(event)
|
105
|
-
@filters.
|
100
|
+
event if @filters.any? { |f| f.filter(event) }
|
106
101
|
end
|
107
102
|
|
108
103
|
def parse(event)
|
109
|
-
@parsers.reduce(event) { |e, p| p.parse(e) if e
|
104
|
+
@parsers.reduce(event) { |e, p| p.parse(e) if e }
|
110
105
|
end
|
111
106
|
|
112
107
|
def buffer(event)
|
@@ -114,28 +109,35 @@ module Fusuma
|
|
114
109
|
end
|
115
110
|
|
116
111
|
# @param buffers [Array<Buffer>]
|
117
|
-
# @return [Event]
|
118
|
-
# @return [NilClass] if event is NOT detected
|
112
|
+
# @return [Array<Event>]
|
119
113
|
def detect(buffers)
|
120
|
-
@detectors.
|
121
|
-
event = detector.detect(buffers)
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
buffers.each(&:clear) # clear buffer
|
126
|
-
break(event)
|
114
|
+
@detectors.reduce([]) do |detected, detector|
|
115
|
+
if (event = detector.detect(buffers))
|
116
|
+
detected << event
|
117
|
+
else
|
118
|
+
detected
|
127
119
|
end
|
128
|
-
|
129
|
-
break nil if @detectors.last == detector
|
130
120
|
end
|
131
121
|
end
|
132
122
|
|
123
|
+
# @param events [Array<Event>]
|
124
|
+
# @return [Event] a Event merged all records from arguments
|
125
|
+
# @return [NilClass] when event is NOT given
|
126
|
+
def merge(events)
|
127
|
+
main_events, modifiers = events.partition { |event| event.record.mergable? }
|
128
|
+
return nil unless (main_event = main_events.first)
|
129
|
+
|
130
|
+
main_event.record.merge(records: modifiers.map(&:record))
|
131
|
+
main_event
|
132
|
+
end
|
133
|
+
|
133
134
|
def execute(event)
|
134
135
|
return unless event
|
135
136
|
|
136
137
|
executor = @executors.find do |e|
|
137
138
|
e.executable?(event)
|
138
139
|
end
|
140
|
+
|
139
141
|
executor&.execute(event)
|
140
142
|
end
|
141
143
|
end
|
@@ -9,6 +9,7 @@ module Fusuma
|
|
9
9
|
class IndexRecord < Record
|
10
10
|
# define gesture format
|
11
11
|
attr_reader :index
|
12
|
+
attr_reader :position
|
12
13
|
|
13
14
|
# @param [Config::Index] index
|
14
15
|
# @param [Symbol] position [:prefix, :body, :surfix]
|
@@ -26,12 +27,12 @@ module Fusuma
|
|
26
27
|
def merge(records:)
|
27
28
|
raise "position is NOT body: #{self}" unless mergable?
|
28
29
|
|
29
|
-
@index = records.
|
30
|
+
@index = records.reduce(@index) do |merged_index, record|
|
30
31
|
case record.position
|
31
32
|
when :prefix
|
32
|
-
Index.new([*record.index.keys, *merged_index.keys])
|
33
|
+
Config::Index.new([*record.index.keys, *merged_index.keys])
|
33
34
|
when :surfix
|
34
|
-
Index.new([*merged_index.keys, *record.index.keys])
|
35
|
+
Config::Index.new([*merged_index.keys, *record.index.keys])
|
35
36
|
else
|
36
37
|
raise "invalid index position: #{record}"
|
37
38
|
end
|
@@ -42,10 +43,6 @@ module Fusuma
|
|
42
43
|
def mergable?
|
43
44
|
@position == :body
|
44
45
|
end
|
45
|
-
|
46
|
-
protected
|
47
|
-
|
48
|
-
attr_reader :position
|
49
46
|
end
|
50
47
|
end
|
51
48
|
end
|
@@ -4,22 +4,19 @@ require_relative '../base.rb'
|
|
4
4
|
|
5
5
|
module Fusuma
|
6
6
|
module Plugin
|
7
|
-
# filter class
|
8
7
|
module Filters
|
9
|
-
# Filter
|
8
|
+
# Filter to keep/discard events from input plugin
|
10
9
|
class Filter < Base
|
11
10
|
# Filter input event
|
12
11
|
# @param event [Event]
|
13
|
-
# @return [Event
|
12
|
+
# @return [Event] when keeping event
|
13
|
+
# @return [NilClass] when discarding record
|
14
14
|
def filter(event)
|
15
|
-
event.
|
16
|
-
next if e.tag != source
|
17
|
-
next if keep?(e.record)
|
15
|
+
return event if event.tag !~ /#{source}/
|
18
16
|
|
19
|
-
|
17
|
+
return event if keep?(event.record)
|
20
18
|
|
21
|
-
|
22
|
-
end
|
19
|
+
nil
|
23
20
|
end
|
24
21
|
|
25
22
|
# @abstract override `#keep?` to implement
|
@@ -10,9 +10,10 @@ module Fusuma
|
|
10
10
|
class LibinputCommandInput < Input
|
11
11
|
def config_param_types
|
12
12
|
{
|
13
|
-
'
|
13
|
+
'device': [String],
|
14
14
|
'enable-dwt': [TrueClass, FalseClass],
|
15
|
-
'
|
15
|
+
'enable-tap': [TrueClass, FalseClass],
|
16
|
+
'show-keycodes': [TrueClass, FalseClass]
|
16
17
|
}
|
17
18
|
end
|
18
19
|
|
@@ -88,21 +89,21 @@ module Fusuma
|
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
91
|
-
private
|
92
|
-
|
93
|
-
# TODO: add specs
|
94
92
|
def libinput_options
|
93
|
+
device = ("--device='#{config_params(:device)}'" if config_params(:device))
|
95
94
|
enable_tap = '--enable-tap' if config_params(:'enable-tap')
|
96
|
-
device = ("--device=#{config_params(:device)}" if config_params(:device))
|
97
95
|
enable_dwt = '--enable-dwt' if config_params(:'enable-dwt')
|
98
|
-
|
96
|
+
show_keycodes = '--show-keycodes' if config_params(:'show-keycodes')
|
99
97
|
[
|
100
|
-
enable_tap,
|
101
98
|
device,
|
102
|
-
enable_dwt
|
99
|
+
enable_dwt,
|
100
|
+
enable_tap,
|
101
|
+
show_keycodes
|
103
102
|
].compact
|
104
103
|
end
|
105
104
|
|
105
|
+
private
|
106
|
+
|
106
107
|
# which in ruby: Checking if program exists in $PATH from ruby
|
107
108
|
# (https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby)
|
108
109
|
# Cross-platform way of finding an executable in the $PATH.
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
|
-
rubygems_version: 3.0.
|
231
|
+
rubygems_version: 3.0.6
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Multitouch gestures with libinput dirver on X11, Linux
|