fusuma 2.0.5 → 2.1.0

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: e9b2c355ba50b2c62cf23f7c8975d50485710a67b76ffe5a904f67a043c0cac4
4
- data.tar.gz: 655c8dcbc527e11a2a8883391ec3970af2081285d54332da975ddd8015117186
3
+ metadata.gz: c964784d9707a4ca667c19b4c866bd5e0abc8e61e2f0752903c2cac3fd064448
4
+ data.tar.gz: fc9c42d27ee80535d6da10f3cdd0ee707a128ad42f147366dd40f4c2053a273a
5
5
  SHA512:
6
- metadata.gz: 7740116f70ca83b977820801c0c2e4b49cd358d2df040710b1a0fa4c75b10cdb9713f932afb08f543c7ec35ae52f4bd3ab141cdf064914fa0e57d19d49443abb
7
- data.tar.gz: c53b8ec89c8aabd9c0d32674345472ca0814a559a99a14eb001a9eaea6447de7ef955bccfa5ee29cb9b9b3dfbcab5bc550afa479b26600e5b6f0a979c29dd53d
6
+ metadata.gz: 99e47419a912ae9e77215fef51bae8bc6a657ac679dbb9a55873087753f354bc9b077657f2fa7699372931ac7a0d0f3faef7d732da4197e1fcef2623b02b8b9c
7
+ data.tar.gz: 7d8ac348be34c4756e549ac0856fa01119680d5d9ebc7346ca3dc29070023b3a6c8d6a4f2218a3fde6951936d51d8ea0335723dcf2a76285f5ab7a477746ca4e
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fusuma [![Gem Version](https://badge.fury.io/rb/fusuma.svg)](https://badge.fury.io/rb/fusuma) [![Build Status](https://travis-ci.com/iberianpig/fusuma.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma) [![Coverage Status](https://coveralls.io/repos/github/iberianpig/fusuma/badge.svg?branch=master)](https://coveralls.io/github/iberianpig/fusuma?branch=master) [![Inline docs](http://inch-ci.org/github/iberianpig/fusuma.svg?branch=master)](http://inch-ci.org/github/iberianpig/fusuma)
1
+ # Fusuma [![Gem Version](https://badge.fury.io/rb/fusuma.svg)](https://badge.fury.io/rb/fusuma) [![Build Status](https://travis-ci.com/iberianpig/fusuma.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma) [![Coverage Status](https://coveralls.io/repos/github/iberianpig/fusuma/badge.svg?branch=master)](https://coveralls.io/github/iberianpig/fusuma?branch=master)
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.
@@ -298,6 +298,7 @@ swipe:
298
298
  - `-l`, `--list-devices` : List available devices
299
299
  - `-v`, `--verbose` : Show details about the results of running fusuma
300
300
  - `--version` : Show fusuma version
301
+ - `--log-file=path/to/file` : Set path of log file
301
302
 
302
303
  ### Specify touchpads by device name
303
304
  Set the following options to recognize multi-touch gestures only for the specified touchpad device.
data/exe/fusuma CHANGED
@@ -22,6 +22,11 @@ opt.on('-l', '--list-devices',
22
22
  option[:list] = v
23
23
  end
24
24
 
25
+ opt.on('--log=path/to/file',
26
+ 'Print logs to file') do |v|
27
+ option[:log_filepath] = v
28
+ end
29
+
25
30
  opt.on('--device="Device name"',
26
31
  'Open the given device only (DEPRECATED)') do |v|
27
32
  option[:device] = v
@@ -11,9 +11,21 @@ module Fusuma
11
11
  attr_reader :err_logger
12
12
  attr_accessor :debug_mode
13
13
 
14
+ @@filepath = nil
15
+ def self.filepath=(filepath)
16
+ @@filepath = filepath
17
+ end
18
+
14
19
  def initialize
15
- super($stdout)
16
- @err_logger = Logger.new($stderr)
20
+ if @@filepath
21
+ logfile = File.new(@@filepath, 'a')
22
+ super(logfile)
23
+ $stderr = logfile
24
+ @err_logger = Logger.new($stderr)
25
+ else
26
+ super($stdout)
27
+ @err_logger = Logger.new($stderr)
28
+ end
17
29
  @debug_mode = false
18
30
  end
19
31
 
@@ -62,8 +62,15 @@ module Fusuma
62
62
  if status == 'update'
63
63
  return unless moved?(prev_event, event)
64
64
 
65
- avg_zoom = gesture_buffer.avg_attrs(:zoom)
66
- first_zoom = updating_events.first.record.delta.zoom
65
+ first_zoom, avg_zoom = if updating_events.size >= 10
66
+ [updating_events[-10].record.delta.zoom,
67
+ gesture_buffer.class.new(
68
+ updating_events[-10..-1]
69
+ ).avg_attrs(:zoom)]
70
+ else
71
+ [updating_events.first.record.delta.zoom,
72
+ gesture_buffer.avg_attrs(:zoom)]
73
+ end
67
74
 
68
75
  oneshot_quantity = Quantity.new(target: avg_zoom, base: first_zoom).to_f
69
76
  oneshot_direction = Direction.new(target: avg_zoom, base: first_zoom).to_s
@@ -24,8 +24,14 @@ module Fusuma
24
24
  updating_events = gesture_buffer.updating_events
25
25
  return if updating_events.empty?
26
26
 
27
- updating_time = 100 * (updating_events.last.time - updating_events.first.time)
28
- oneshot_angle = gesture_buffer.sum_attrs(:rotate) / updating_time
27
+ oneshot_angle = if updating_events.size >= 10
28
+ updating_time = 100 * (updating_events[-1].time - updating_events[-10].time)
29
+ last_10 = gesture_buffer.class.new(updating_events[-10..-1])
30
+ last_10.sum_attrs(:rotate) / updating_time
31
+ else
32
+ updating_time = 100 * (updating_events.last.time - updating_events.first.time)
33
+ gesture_buffer.sum_attrs(:rotate) / updating_time
34
+ end
29
35
 
30
36
  return if updating_events.empty?
31
37
 
@@ -24,9 +24,17 @@ module Fusuma
24
24
  updating_events = gesture_buffer.updating_events
25
25
  return if updating_events.empty?
26
26
 
27
- updating_time = 100 * (updating_events.last.time - updating_events.first.time)
28
- oneshot_move_x = gesture_buffer.sum_attrs(:move_x) / updating_time
29
- oneshot_move_y = gesture_buffer.sum_attrs(:move_y) / updating_time
27
+ oneshot_move_x, oneshot_move_y = if updating_events.size >= 10
28
+ updating_time = 100 * (updating_events[-1].time - updating_events[-10].time)
29
+ last_10 = gesture_buffer.class.new(updating_events[-10..-1])
30
+ [last_10.sum_attrs(:move_x) / updating_time,
31
+ last_10.sum_attrs(:move_y) / updating_time]
32
+ else
33
+ updating_time = 100 * (updating_events.last.time - updating_events.first.time)
34
+ [gesture_buffer.sum_attrs(:move_x) / updating_time,
35
+ gesture_buffer.sum_attrs(:move_y) / updating_time]
36
+ end
37
+ gesture_buffer.sum_attrs(:move_x) / updating_time
30
38
 
31
39
  finger = gesture_buffer.finger
32
40
  status = case gesture_buffer.events.last.record.status
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = '2.0.5'
4
+ VERSION = '2.1.0'
5
5
  end
data/lib/fusuma.rb CHANGED
@@ -29,6 +29,7 @@ module Fusuma
29
29
  end
30
30
 
31
31
  def read_options(option)
32
+ MultiLogger.filepath = option[:log_filepath]
32
33
  MultiLogger.instance.debug_mode = option[:verbose]
33
34
 
34
35
  load_custom_config(option[:config_path])
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: 2.0.5
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
14
14
  on Linux able to recognize swipes or pinchs and assign command to them. Read installation
@@ -106,7 +106,7 @@ licenses:
106
106
  - MIT
107
107
  metadata:
108
108
  yard.run: yri
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,44 +121,44 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.1.4
125
- signing_key:
124
+ rubygems_version: 3.2.22
125
+ signing_key:
126
126
  specification_version: 4
127
127
  summary: Multitouch gestures with libinput driver, Linux
128
128
  test_files:
129
- - spec/lib/device_spec.rb
129
+ - spec/helpers/config_helper.rb
130
130
  - spec/lib/config/searcher_spec.rb
131
- - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
131
+ - spec/lib/config_spec.rb
132
+ - spec/lib/custom_process_spec.rb
133
+ - spec/lib/device_spec.rb
132
134
  - spec/lib/dummy_config.yml
135
+ - spec/lib/fusuma_spec.rb
136
+ - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
133
137
  - spec/lib/libinput-list-devices_magic_trackpad.txt
134
- - spec/lib/custom_process_spec.rb
138
+ - spec/lib/libinput-list-devices_razer_razer_blade.txt
139
+ - spec/lib/libinput-list-devices_thejinx0r.txt
140
+ - spec/lib/libinput-list-devices_unavailable.txt
141
+ - spec/lib/libinput_command_spec.rb
135
142
  - spec/lib/plugin/base_spec.rb
136
- - spec/lib/plugin/inputs/libinput_command_input_spec.rb
137
- - spec/lib/plugin/inputs/input_spec.rb
138
- - spec/lib/plugin/inputs/timer_input_spec.rb
139
- - spec/lib/plugin/events/records/record_spec.rb
143
+ - spec/lib/plugin/buffers/buffer_spec.rb
144
+ - spec/lib/plugin/buffers/dummy_buffer.rb
145
+ - spec/lib/plugin/buffers/gesture_buffer_spec.rb
146
+ - spec/lib/plugin/detectors/detector_spec.rb
147
+ - spec/lib/plugin/detectors/dummy_detector.rb
148
+ - spec/lib/plugin/detectors/pinch_detector_spec.rb
149
+ - spec/lib/plugin/detectors/rotate_detector_spec.rb
150
+ - spec/lib/plugin/detectors/swipe_detector_spec.rb
151
+ - spec/lib/plugin/events/event_spec.rb
140
152
  - spec/lib/plugin/events/records/gesture_record_spec.rb
153
+ - spec/lib/plugin/events/records/record_spec.rb
141
154
  - spec/lib/plugin/events/records/text_record_spec.rb
142
- - spec/lib/plugin/events/event_spec.rb
143
- - spec/lib/plugin/filters/libinput_filter_spec.rb
155
+ - spec/lib/plugin/executors/command_executor_spec.rb
156
+ - spec/lib/plugin/executors/executor_spec.rb
144
157
  - spec/lib/plugin/filters/filter_spec.rb
145
- - spec/lib/plugin/detectors/detector_spec.rb
146
- - spec/lib/plugin/detectors/swipe_detector_spec.rb
147
- - spec/lib/plugin/detectors/rotate_detector_spec.rb
148
- - spec/lib/plugin/detectors/pinch_detector_spec.rb
149
- - spec/lib/plugin/detectors/dummy_detector.rb
158
+ - spec/lib/plugin/filters/libinput_filter_spec.rb
159
+ - spec/lib/plugin/inputs/input_spec.rb
160
+ - spec/lib/plugin/inputs/libinput_command_input_spec.rb
161
+ - spec/lib/plugin/inputs/timer_input_spec.rb
150
162
  - spec/lib/plugin/manager_spec.rb
151
- - spec/lib/plugin/buffers/dummy_buffer.rb
152
- - spec/lib/plugin/buffers/buffer_spec.rb
153
- - spec/lib/plugin/buffers/gesture_buffer_spec.rb
154
163
  - spec/lib/plugin/parsers/parser_spec.rb
155
- - spec/lib/plugin/executors/executor_spec.rb
156
- - spec/lib/plugin/executors/command_executor_spec.rb
157
- - spec/lib/libinput-list-devices_unavailable.txt
158
- - spec/lib/libinput_command_spec.rb
159
- - spec/lib/fusuma_spec.rb
160
- - spec/lib/libinput-list-devices_razer_razer_blade.txt
161
- - spec/lib/libinput-list-devices_thejinx0r.txt
162
- - spec/lib/config_spec.rb
163
- - spec/helpers/config_helper.rb
164
164
  - spec/spec_helper.rb