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 +4 -4
- data/README.md +1 -1
- data/lib/fusuma.rb +20 -15
- data/lib/fusuma/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 398df757b365af8b55ab7afffa65413743511b8a
|
4
|
+
data.tar.gz: ae91c25c056b3c41824660a0143a5677704c1b32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/fusuma.rb
CHANGED
@@ -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
|
82
|
-
return false unless line =~ /^
|
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
|
data/lib/fusuma/version.rb
CHANGED