fusuma 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: d452e20ebad5d8c74a1024a89efca191cb81393c
4
- data.tar.gz: 2b2bf688c6cac49dd066984c90716b81bef7f27c
3
+ metadata.gz: 398df757b365af8b55ab7afffa65413743511b8a
4
+ data.tar.gz: ae91c25c056b3c41824660a0143a5677704c1b32
5
5
  SHA512:
6
- metadata.gz: ae305dcac96bb69a2fee49023db151ecbf43d8352c4e3420b76502a7cc6ecd28524af3dd530d8a2ec94e77f76d0f0c9d748295480feeb72c1116d5c2c74694e3
7
- data.tar.gz: 27b1bcc29712827903be117dff7ea92cabe03c629c2ff2a26e26600e164e035506f472bbea3ebc62a5d3626550a67cc065402b1b6f8506f0258be03b15585ead
6
+ metadata.gz: 3fa1e4fb6147cf9b4a207c3c6afeaec9ea86f52675a744a7b632b3abd96cdbfe891777ea3c02fd97b3e524fe0f0531dadf69914c2c3147616859e86c96125c5a
7
+ data.tar.gz: d79c0e282e3ecea89f1c9c13d33efb2e251c129719e3f90e2ef4d304bc6e53f8aa922aab8b7ed21f6d7d1847bc1dfb988fe70694f7155bda640e199da47199e3
data/README.md CHANGED
@@ -10,7 +10,7 @@ This gem makes your linux PC able to recognize swipes or pinchs and assign short
10
10
  ## Installation
11
11
 
12
12
  IMPORTANT: You must be a member of the _input_ group to have permission
13
- to read the touchpad device:
13
+ to read the touchpad device:
14
14
 
15
15
  $ sudo gpasswd -a $USER input
16
16
 
@@ -45,8 +45,26 @@ module Fusuma
45
45
  end
46
46
  end
47
47
 
48
+ def device_names
49
+ return @device_names unless @device_names.nil?
50
+ names = []
51
+ @device_names = list_devices_logs.map do |line|
52
+ MultiLogger.debug(line)
53
+ name = extracted_input_device_from(line)
54
+ names << name unless name.nil?
55
+ next unless natural_scroll_is_available?(line)
56
+ names.pop
57
+ end.compact
58
+ end
59
+
48
60
  private
49
61
 
62
+ def list_devices_logs
63
+ Open3.popen3('libinput-list-devices') do |_i, o, _e, _w|
64
+ return o.to_a
65
+ end
66
+ end
67
+
50
68
  def libinput_command
51
69
  return @libinput_command if @libinput_command
52
70
  # NOTE: --enable-dwt means "disable while typing"
@@ -60,26 +78,13 @@ module Fusuma
60
78
  @libinput_command
61
79
  end
62
80
 
63
- def device_names
64
- @device_names ||= Open3.popen3('libinput-list-devices') do |_i, o, _e, _w|
65
- device_names = []
66
- o.map do |line|
67
- MultiLogger.debug(line)
68
- device_name = extracted_input_device_from(line)
69
- device_names << device_name unless device_name.nil?
70
- next unless touch_is_available?(line)
71
- device_names.pop
72
- end
73
- end.compact
74
- end
75
-
76
81
  def extracted_input_device_from(line)
77
82
  return unless line =~ /^Kernel: /
78
83
  line.match(/event[0-9]+/).to_s
79
84
  end
80
85
 
81
- def touch_is_available?(line)
82
- return false unless line =~ /^Tap-to-click: /
86
+ def natural_scroll_is_available?(line)
87
+ return false unless line =~ /^Nat.scrolling: /
83
88
  return false if line =~ %r{n/a}
84
89
  true
85
90
  end
@@ -1,3 +1,3 @@
1
1
  module Fusuma
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig