fusuma 1.3.3 → 1.4.0
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/.gitignore +2 -0
- data/CHANGELOG.md +13 -1
- data/README.md +1 -1
- data/lib/fusuma.rb +0 -3
- data/lib/fusuma/device.rb +48 -48
- data/lib/fusuma/plugin/buffers/gesture_buffer.rb +20 -0
- data/lib/fusuma/plugin/inputs/libinput_command_input.rb +2 -2
- data/lib/fusuma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16929054076669742906dca54ea4cc907c5b4adb12d6454261dce202baa5280
|
4
|
+
data.tar.gz: '08cbb875607091af2b3ae0a27f96bb735532527f4e64df534f19dda6c0ea74af'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08fa7c0802ba80260e7c3c7a06e3509d363d314cb49618c8af728f1eb5ee33bc44f9c71f4197d010485583d6c251eb8796c2e62fa30aa81a6bb6124ec0d73caf'
|
7
|
+
data.tar.gz: a01441b1995ec469729deb899c68ff54955a0b4083d943ee137f293d7b0b0202f186263d47dd3f96d1a3f1257686a5394677a8da667311b05870606bfc9ba9f3
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/iberianpig/fusuma/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.3.3...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Can not use fusuma with a error: NoMethodError [\#149](https://github.com/iberianpig/fusuma/issues/149)
|
10
|
+
|
11
|
+
## [v1.3.3](https://github.com/iberianpig/fusuma/tree/v1.3.3) (2020-02-10)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.3.2...v1.3.3)
|
14
|
+
|
3
15
|
## [v1.3.2](https://github.com/iberianpig/fusuma/tree/v1.3.2) (2020-01-07)
|
4
16
|
|
5
17
|
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.3.1...v1.3.2)
|
@@ -107,7 +119,6 @@
|
|
107
119
|
|
108
120
|
- Interval and threshold specific for a trigger [\#92](https://github.com/iberianpig/fusuma/pull/92) ([irq](https://github.com/irq))
|
109
121
|
- Fix spelling: Elementary to elementary [\#90](https://github.com/iberianpig/fusuma/pull/90) ([ryonakano](https://github.com/ryonakano))
|
110
|
-
- Update rake requirement to ~\> 12.3 [\#72](https://github.com/iberianpig/fusuma/pull/72) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
111
122
|
|
112
123
|
## [v0.9.2](https://github.com/iberianpig/fusuma/tree/v0.9.2) (2018-07-19)
|
113
124
|
|
@@ -197,6 +208,7 @@
|
|
197
208
|
**Merged pull requests:**
|
198
209
|
|
199
210
|
- Assigning commands [\#73](https://github.com/iberianpig/fusuma/pull/73) ([iberianpig](https://github.com/iberianpig))
|
211
|
+
- Update rake requirement to ~\> 12.3 [\#72](https://github.com/iberianpig/fusuma/pull/72) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
200
212
|
|
201
213
|
## [v0.3.5](https://github.com/iberianpig/fusuma/tree/v0.3.5) (2018-01-01)
|
202
214
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Fusuma [](https://badge.fury.io/rb/fusuma) [](https://badge.fury.io/rb/fusuma) [](https://travis-ci.com/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.
|
data/lib/fusuma.rb
CHANGED
@@ -127,9 +127,6 @@ module Fusuma
|
|
127
127
|
main_events, modifiers = events.partition { |event| event.record.mergable? }
|
128
128
|
return nil unless (main_event = main_events.first)
|
129
129
|
|
130
|
-
# NOTE: clear buffers after detected main_event
|
131
|
-
@buffers.each(&:clear)
|
132
|
-
|
133
130
|
main_event.record.merge(records: modifiers.map(&:record))
|
134
131
|
main_event
|
135
132
|
end
|
data/lib/fusuma/device.rb
CHANGED
@@ -61,71 +61,71 @@ module Fusuma
|
|
61
61
|
end
|
62
62
|
line_parser.generate_devices
|
63
63
|
end
|
64
|
+
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
def initialize
|
70
|
-
@lines = []
|
71
|
-
end
|
66
|
+
# parse line and generate devices
|
67
|
+
class LineParser
|
68
|
+
attr_reader :lines
|
72
69
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
70
|
+
def initialize
|
71
|
+
@lines = []
|
72
|
+
end
|
77
73
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
# @param line [String]
|
75
|
+
def push(line)
|
76
|
+
lines.push(line)
|
77
|
+
end
|
82
78
|
|
83
|
-
|
79
|
+
# @return [Array]
|
80
|
+
def generate_devices
|
81
|
+
lines.each_with_object([]) do |line, devices|
|
82
|
+
attributes = extract_attribute(line: line)
|
84
83
|
|
85
|
-
|
86
|
-
# when detected new line including device name
|
87
|
-
devices << Device.new # next device
|
88
|
-
end
|
84
|
+
next if attributes == {}
|
89
85
|
|
90
|
-
|
86
|
+
if attributes[:name]
|
87
|
+
# when detected new line including device name
|
88
|
+
devices << Device.new # next device
|
91
89
|
end
|
90
|
+
|
91
|
+
devices.last.assign_attributes(attributes) unless devices.empty?
|
92
92
|
end
|
93
|
+
end
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
95
|
+
# @param line [String]
|
96
|
+
# @return [Hash]
|
97
|
+
def extract_attribute(line:)
|
98
|
+
if (id = id_from(line))
|
99
|
+
{ id: id }
|
100
|
+
elsif (name = name_from(line))
|
101
|
+
{ name: name }
|
102
|
+
elsif (available = available_from(line))
|
103
|
+
{ available: available }
|
104
|
+
else
|
105
|
+
{}
|
106
106
|
end
|
107
|
+
end
|
107
108
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
109
|
+
def id_from(line)
|
110
|
+
line.match('^Kernel:[[:space:]]*') do |m|
|
111
|
+
m.post_match.match(/event[0-9]+/).to_s
|
112
112
|
end
|
113
|
+
end
|
113
114
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
115
|
+
def name_from(line)
|
116
|
+
line.match('^Device:[[:space:]]*') do |m|
|
117
|
+
m.post_match.strip
|
118
118
|
end
|
119
|
+
end
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
def available_from(line)
|
122
|
+
# NOTE: is natural scroll available?
|
123
|
+
if line =~ /^Nat.scrolling: /
|
124
|
+
return false if line =~ %r{n/a}
|
124
125
|
|
125
|
-
|
126
|
-
end
|
127
|
-
nil
|
126
|
+
return true # disabled / enabled
|
128
127
|
end
|
128
|
+
nil
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -8,6 +8,14 @@ module Fusuma
|
|
8
8
|
# manage events and generate command
|
9
9
|
class GestureBuffer < Buffer
|
10
10
|
DEFAULT_SOURCE = 'libinput_gesture_parser'
|
11
|
+
DEFAULT_SECONDS_TO_KEEP = 0.1
|
12
|
+
|
13
|
+
def config_param_types
|
14
|
+
{
|
15
|
+
'source': [String],
|
16
|
+
'seconds_to_keep': [Float, Integer]
|
17
|
+
}
|
18
|
+
end
|
11
19
|
|
12
20
|
# @param event [Event]
|
13
21
|
def buffer(event)
|
@@ -17,6 +25,8 @@ module Fusuma
|
|
17
25
|
# - other event buffer
|
18
26
|
return if event&.tag != source
|
19
27
|
|
28
|
+
delete_old_events
|
29
|
+
|
20
30
|
@events.push(event)
|
21
31
|
clear unless updating?
|
22
32
|
end
|
@@ -60,6 +70,16 @@ module Fusuma
|
|
60
70
|
|
61
71
|
private
|
62
72
|
|
73
|
+
# Delete old events pushed before 0.1sec
|
74
|
+
def delete_old_events
|
75
|
+
@seconds_to_keep ||= (config_params(:seconds_to_keep) || DEFAULT_SECONDS_TO_KEEP)
|
76
|
+
@events.each do |e|
|
77
|
+
break if Time.now - e.time < @seconds_to_keep
|
78
|
+
|
79
|
+
@events.delete(e)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
63
83
|
def updating?
|
64
84
|
return true unless @events.last.record.status =~ /begin|end/
|
65
85
|
end
|
@@ -38,7 +38,7 @@ module Fusuma
|
|
38
38
|
@version ||= `#{version_command}`.strip
|
39
39
|
end
|
40
40
|
|
41
|
-
# @
|
41
|
+
# @yieldparam [String] gives a line in libinput list-devices output to the block
|
42
42
|
def list_devices
|
43
43
|
cmd = list_devices_command
|
44
44
|
MultiLogger.debug(list_devices: cmd)
|
@@ -47,7 +47,7 @@ module Fusuma
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
# @
|
50
|
+
# @yieldparam [String] gives a line in libinput debug-events output to the block
|
51
51
|
def debug_events
|
52
52
|
prefix = 'stdbuf -oL --'
|
53
53
|
options = [*libinput_options]
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|