fusuma 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/fusuma.gemspec +2 -3
- data/lib/fusuma/libinput_command.rb +7 -12
- data/lib/fusuma/plugin/executors/command_executor.rb +3 -3
- data/lib/fusuma/plugin/inputs/libinput_command_input.rb +9 -2
- data/lib/fusuma/version.rb +1 -1
- data/spec/lib/device_spec.rb +2 -4
- data/spec/lib/libinput_command_spec.rb +17 -24
- data/spec/lib/plugin/executors/command_executor_spec.rb +1 -1
- data/spec/lib/plugin/inputs/libinput_command_input_spec.rb +2 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d8b83e60047931022dab6daf54c40da12ec392b638d44c21491528ec7e13bed
|
4
|
+
data.tar.gz: 6e491edb08ad8b2c7f277986cf7d9226663867c1013fec52b04740649e35770d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015112ebf7229f9d48c00735007a598d727bda17e16f4da3b4a6b1d3c8f05ce106d709aabe300414c1232cebc1f52e834fb6cca1961507a60ce6f7528058513a
|
7
|
+
data.tar.gz: c489bd3dbf6c6dd1227e3864abe9c075f6288cf448b8a2b7e85ef092c0586e75b24c76dda16e370ee92bc749fbe378e73bfa376d732dca474cfa43e580af6bfe
|
data/README.md
CHANGED
@@ -330,12 +330,13 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
|
|
330
330
|
|
331
331
|
### Available plugins
|
332
332
|
|
333
|
-
| Name
|
334
|
-
|
|
335
|
-
| [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey)
|
336
|
-
| [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | Manages Window and Workspace |
|
337
|
-
| [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | Detects gestures while pressing multiple keys |
|
338
|
-
| [fusuma-plugin-tap](https://github.com/iberianpig/fusuma-plugin-tap)
|
333
|
+
| Name | Version | About |
|
334
|
+
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------- |
|
335
|
+
| [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | ![Gem Version](https://badge.fury.io/rb/fusuma-plugin-sendkey.svg) | Emulates keyboard events |
|
336
|
+
| [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | ![Gem Version](https://badge.fury.io/rb/fusuma-plugin-wmctrl.svg) | Manages Window and Workspace |
|
337
|
+
| [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | ![Gem Version](https://badge.fury.io/rb/fusuma-plugin-keypress.svg) | Detects gestures while pressing multiple keys |
|
338
|
+
| [fusuma-plugin-tap](https://github.com/iberianpig/fusuma-plugin-tap) | ![Gem Version](https://badge.fury.io/rb/fusuma-plugin-tap.svg) | Detects Tap and Hold gestures |
|
339
|
+
| [fusuma-plugin-appmatcher](https://github.com/iberianpig/fusuma-plugin-appmatcher) | ![Gem Version](https://badge.fury.io/rb/fusuma-plugin-appmatcher.svg) | Configure app-specific gestures |
|
339
340
|
|
340
341
|
## Tutorial Video
|
341
342
|
|
data/fusuma.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = 'https://github.com/iberianpig/fusuma'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.files = Dir
|
19
|
-
spec.test_files = Dir
|
18
|
+
spec.files = Dir['{bin,lib,exe}/**/*', 'LICENSE*', 'README*', '*.gemspec']
|
19
|
+
spec.test_files = Dir['{test,spec,features}/**/*']
|
20
20
|
spec.bindir = 'exe'
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
@@ -24,5 +24,4 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 2.5.1' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all§ion=main
|
26
26
|
# support bionic (18.04LTS) 2.5.1
|
27
|
-
spec.add_dependency 'posix-spawn'
|
28
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'open3'
|
4
4
|
|
5
5
|
module Fusuma
|
6
6
|
# Execute libinput command
|
@@ -33,21 +33,16 @@ module Fusuma
|
|
33
33
|
def list_devices(&block)
|
34
34
|
cmd = list_devices_command
|
35
35
|
MultiLogger.debug(list_devices: cmd)
|
36
|
-
|
36
|
+
i, o, e, _w = Open3.popen3(cmd)
|
37
|
+
MultiLogger.error(e.read) if o.eof?
|
37
38
|
i.close
|
39
|
+
e.close
|
38
40
|
o.each(&block)
|
39
|
-
ensure
|
40
|
-
[i, o, e].each { |io| io.close unless io.closed? }
|
41
|
-
Process.waitpid(p)
|
42
41
|
end
|
43
42
|
|
44
|
-
# @return [Integer
|
45
|
-
def debug_events
|
46
|
-
@debug_events
|
47
|
-
p, i, o, _e = POSIX::Spawn.popen4(debug_events_with_options)
|
48
|
-
i.close
|
49
|
-
[p, o]
|
50
|
-
end
|
43
|
+
# @return [Integer] return a latest line libinput debug-events
|
44
|
+
def debug_events(writer)
|
45
|
+
@debug_events ||= Process.spawn(debug_events_with_options, out: writer, in: '/dev/null')
|
51
46
|
end
|
52
47
|
|
53
48
|
# @return [String] command
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'posix/spawn'
|
4
3
|
require_relative './executor'
|
5
4
|
|
6
5
|
module Fusuma
|
@@ -20,11 +19,12 @@ module Fusuma
|
|
20
19
|
|
21
20
|
MultiLogger.info(command: command, args: event.record.args)
|
22
21
|
|
22
|
+
accel = args_accel(event)
|
23
23
|
additional_env = event.record.args
|
24
24
|
.deep_transform_keys(&:to_s)
|
25
|
-
.deep_transform_values { |v| (v *
|
25
|
+
.deep_transform_values { |v| (v * accel).to_s }
|
26
26
|
|
27
|
-
pid =
|
27
|
+
pid = Process.spawn(additional_env, command.to_s)
|
28
28
|
Process.detach(pid)
|
29
29
|
end
|
30
30
|
end
|
@@ -25,8 +25,9 @@ module Fusuma
|
|
25
25
|
# @return [IO]
|
26
26
|
def io
|
27
27
|
@io ||= begin
|
28
|
-
|
29
|
-
|
28
|
+
reader, writer = create_io
|
29
|
+
@pid = command.debug_events(writer)
|
30
|
+
reader
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -64,6 +65,12 @@ module Fusuma
|
|
64
65
|
def list_devices_command
|
65
66
|
config_params(:'libinput-list-devices')
|
66
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def create_io
|
72
|
+
IO.pipe
|
73
|
+
end
|
67
74
|
end
|
68
75
|
end
|
69
76
|
end
|
data/lib/fusuma/version.rb
CHANGED
data/spec/lib/device_spec.rb
CHANGED
@@ -24,11 +24,9 @@ module Fusuma
|
|
24
24
|
.and_return(libinput_device_command)
|
25
25
|
|
26
26
|
@dummy_io = StringIO.new('dummy')
|
27
|
-
allow(
|
28
|
-
|
29
|
-
allow(POSIX::Spawn).to receive(:popen4)
|
27
|
+
allow(Open3).to receive(:popen3)
|
30
28
|
.with(libinput_device_command)
|
31
|
-
.and_return([
|
29
|
+
.and_return([@dummy_io, list_devices_output, @dummy_io, nil])
|
32
30
|
end
|
33
31
|
|
34
32
|
context 'with XPS-9360 (have a correct device)' do
|
@@ -79,15 +79,14 @@ module Fusuma
|
|
79
79
|
before do
|
80
80
|
dummy_io = StringIO.new('dummy')
|
81
81
|
io = StringIO.new('dummy output')
|
82
|
-
allow(
|
83
|
-
allow(Process).to receive(:waitpid).and_return(nil)
|
82
|
+
allow(Open3).to receive(:popen3).with(anything).and_return([dummy_io, io, dummy_io, dummy_io, nil])
|
84
83
|
end
|
85
84
|
|
86
85
|
context 'with the alternative command' do
|
87
86
|
let(:commands) { { list_devices_command: 'dummy_list_devices' } }
|
88
87
|
|
89
88
|
it 'should call dummy events' do
|
90
|
-
expect(
|
89
|
+
expect(Open3).to receive(:popen3).with(/dummy_list_devices/)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
@@ -99,7 +98,7 @@ module Fusuma
|
|
99
98
|
|
100
99
|
it 'call `libinput list-devices`' do
|
101
100
|
command = 'libinput list-devices'
|
102
|
-
expect(
|
101
|
+
expect(Open3).to receive(:popen3)
|
103
102
|
.with(command)
|
104
103
|
end
|
105
104
|
end
|
@@ -111,27 +110,33 @@ module Fusuma
|
|
111
110
|
|
112
111
|
it 'call `libinput-list-devices`' do
|
113
112
|
command = 'libinput-list-devices'
|
114
|
-
expect(
|
113
|
+
expect(Open3).to receive(:popen3)
|
115
114
|
.with(command)
|
116
115
|
end
|
117
116
|
end
|
118
117
|
end
|
119
118
|
|
120
119
|
describe 'debug_events' do
|
121
|
-
subject { libinput_command.debug_events }
|
122
120
|
before do
|
123
|
-
dummy_io = StringIO.new('dummy')
|
124
|
-
allow(
|
121
|
+
@dummy_io = StringIO.new('dummy')
|
122
|
+
allow(Process).to receive(:spawn).with(anything).and_return(0)
|
125
123
|
end
|
124
|
+
subject { libinput_command.debug_events(@dummy_io) }
|
126
125
|
|
127
126
|
context 'with the alternative command' do
|
128
|
-
|
127
|
+
before do
|
128
|
+
allow(libinput_command).to receive(:debug_events_with_options).and_return 'dummy_debug_events'
|
129
|
+
end
|
129
130
|
|
130
131
|
it 'should call dummy events' do
|
131
|
-
expect(
|
132
|
+
expect(Process).to receive(:spawn).with('dummy_debug_events', { out: @dummy_io, in: '/dev/null' }).once
|
132
133
|
subject
|
133
134
|
end
|
134
135
|
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#debug_events_with_options' do
|
139
|
+
subject { libinput_command.debug_events_with_options }
|
135
140
|
|
136
141
|
context 'with new cli version' do
|
137
142
|
before do
|
@@ -139,13 +144,7 @@ module Fusuma
|
|
139
144
|
.to receive(:new_cli_option_available?)
|
140
145
|
.and_return(true)
|
141
146
|
end
|
142
|
-
|
143
|
-
it 'should call `libinput debug-events`' do
|
144
|
-
command = 'libinput debug-events'
|
145
|
-
expect(POSIX::Spawn).to receive(:popen4)
|
146
|
-
.with("stdbuf -oL -- #{command}")
|
147
|
-
subject
|
148
|
-
end
|
147
|
+
it { is_expected.to eq 'stdbuf -oL -- libinput debug-events' }
|
149
148
|
end
|
150
149
|
|
151
150
|
context 'with old cli version' do
|
@@ -154,13 +153,7 @@ module Fusuma
|
|
154
153
|
.to receive(:new_cli_option_available?)
|
155
154
|
.and_return(false)
|
156
155
|
end
|
157
|
-
|
158
|
-
it 'should call `libinput-debug-events`' do
|
159
|
-
command = 'libinput-debug-events'
|
160
|
-
expect(POSIX::Spawn).to receive(:popen4)
|
161
|
-
.with("stdbuf -oL -- #{command}")
|
162
|
-
subject
|
163
|
-
end
|
156
|
+
it { is_expected.to eq 'stdbuf -oL -- libinput-debug-events' }
|
164
157
|
end
|
165
158
|
end
|
166
159
|
end
|
@@ -33,7 +33,7 @@ module Fusuma
|
|
33
33
|
it 'spawn' do
|
34
34
|
command = 'echo dummy'
|
35
35
|
env = {}
|
36
|
-
expect(
|
36
|
+
expect(Process).to receive(:spawn).with(env, command)
|
37
37
|
expect(Process).to receive(:detach).with(anything)
|
38
38
|
@executor.execute(@event)
|
39
39
|
end
|
@@ -15,7 +15,8 @@ module Fusuma
|
|
15
15
|
dummy_pid = 999_999_999
|
16
16
|
libinput_command = instance_double(LibinputCommand)
|
17
17
|
allow(LibinputCommand).to receive(:new).and_return(libinput_command)
|
18
|
-
allow(libinput_command).to receive(:debug_events).
|
18
|
+
allow(libinput_command).to receive(:debug_events).with(@dummy_io).and_return(dummy_pid)
|
19
|
+
allow(input).to receive(:create_io).and_return [@dummy_io, @dummy_io]
|
19
20
|
end
|
20
21
|
|
21
22
|
it { expect(input.io).to eq @dummy_io }
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusuma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: posix-spawn
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
|
28
14
|
on Linux able to recognize swipes or pinchs and assign command to them. Read installation
|
29
15
|
on Github(https://github.com/iberianpig/fusuma#installation).
|