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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d8572f753f134496b8ffc0f36c3aafbf142357aad913edd9fd5f5d494d32259
4
- data.tar.gz: 6adf4afa35ca59305efa6bde88b2ccf808c3025b5a577cc917d0b32d6b794058
3
+ metadata.gz: 5d8b83e60047931022dab6daf54c40da12ec392b638d44c21491528ec7e13bed
4
+ data.tar.gz: 6e491edb08ad8b2c7f277986cf7d9226663867c1013fec52b04740649e35770d
5
5
  SHA512:
6
- metadata.gz: 68dbe15577eb01891537a573c96ab0a2c532e919588c4fdb62899b236382630d8f575f913c9de282bf9a66b5ae8f91cc820067eedc7ecaa42e839f25d090afd8
7
- data.tar.gz: cd74e943167bff03bf2eb1d3eaa9d170f28fd921c3736bcc1a981e49f0c7b755de10ecd8b9b6f314bce76377568441e04cd5228222cfe3c3afd32448569a754c
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 | About |
334
- | ------------------------------------------------------------------------------ | --------------------------------------------- |
335
- | [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | Emulates keyboard events |
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) | Detects Tap and Hold gestures |
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.glob('{bin,lib,exe}/**/*') + %w[LICENSE README.md fusuma.gemspec]
19
- spec.test_files = Dir.glob("{test,spec,features}/**/*")
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&section=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 'posix/spawn'
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
- p, i, o, e = POSIX::Spawn.popen4(cmd)
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, IO] return a latest line libinput debug-events
45
- def debug_events
46
- @debug_events = begin
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 * args_accel(event)).to_s }
25
+ .deep_transform_values { |v| (v * accel).to_s }
26
26
 
27
- pid = POSIX::Spawn.spawn(additional_env, command.to_s)
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
- @pid, io = command.debug_events
29
- io
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = '2.0.2'
4
+ VERSION = '2.0.3'
5
5
  end
@@ -24,11 +24,9 @@ module Fusuma
24
24
  .and_return(libinput_device_command)
25
25
 
26
26
  @dummy_io = StringIO.new('dummy')
27
- allow(Process).to receive(:waitpid).and_return(nil)
28
-
29
- allow(POSIX::Spawn).to receive(:popen4)
27
+ allow(Open3).to receive(:popen3)
30
28
  .with(libinput_device_command)
31
- .and_return([nil, @dummy_io, list_devices_output, @dummy_io])
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(POSIX::Spawn).to receive(:popen4).with(anything).and_return([nil, dummy_io, io, dummy_io])
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(POSIX::Spawn).to receive(:popen4).with(/dummy_list_devices/)
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(POSIX::Spawn).to receive(:popen4)
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(POSIX::Spawn).to receive(:popen4)
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(POSIX::Spawn).to receive(:popen4).with(anything).and_return([nil, dummy_io, dummy_io, dummy_io])
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
- let(:commands) { { debug_events_command: 'dummy_debug_events' } }
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(POSIX::Spawn).to receive(:popen4).with(/dummy_debug_events/).once
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(POSIX::Spawn).to receive(:spawn).with(env, command)
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).and_return([dummy_pid, @dummy_io])
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.2
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 00:00:00.000000000 Z
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).