fusuma 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +21 -1
- data/lib/fusuma.rb +3 -2
- data/lib/fusuma/device.rb +4 -1
- data/lib/fusuma/libinput_command.rb +96 -0
- data/lib/fusuma/plugin/inputs/libinput_command_input.rb +1 -87
- data/lib/fusuma/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2653f2589093ec363f62b29d398ed622314f30d9a8c902c3c7f893470c5549a0
|
4
|
+
data.tar.gz: 5076d2ee1091be519a3f1eac11b536bf66120c6b9faf485e202e6bf4ecb47d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7433bbb5eb068c0b1f9d3d9e4492878d672105504a5603b7bd4d92c9cb61e34cbf8559e71c0b3d407bba59b5f640e9031e106e8c4cbf38c53f85f871c2517592
|
7
|
+
data.tar.gz: 23425a4be0e42f0b006a424e067bed3c18be3e8768173dd8bdc6df5f070339e1613a7319de4ab70fd06981871db38210c8f26aa3e5e030cc3021a5b565d2f358
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.6.0](https://github.com/iberianpig/fusuma/tree/v1.6.0) (2020-03-14)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.5.0...v1.6.0)
|
6
|
+
|
7
|
+
## [v1.5.0](https://github.com/iberianpig/fusuma/tree/v1.5.0) (2020-03-02)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.4.1...v1.5.0)
|
10
|
+
|
3
11
|
## [v1.4.1](https://github.com/iberianpig/fusuma/tree/v1.4.1) (2020-02-27)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.4.0...v1.4.1)
|
data/README.md
CHANGED
@@ -76,6 +76,13 @@ $ mkdir -p ~/.config/fusuma # create config directory
|
|
76
76
|
$ nano ~/.config/fusuma/config.yml # edit config file.
|
77
77
|
```
|
78
78
|
|
79
|
+
### About YAML Basic Syntax
|
80
|
+
* Comments in YAML begins with the (#) character.
|
81
|
+
* Comments must be separated from other tokens by whitespaces.
|
82
|
+
* Indentation of whitespace is used to denote structure.
|
83
|
+
* Tabs are not included as indentation for YAML files.
|
84
|
+
|
85
|
+
|
79
86
|
### Example 1: Gesture Mapping for elementary OS
|
80
87
|
|
81
88
|
```yaml
|
@@ -245,10 +252,23 @@ Fusuma plugins are provided with the `fusuma-plugin-XXXXX` naming convention and
|
|
245
252
|
| [fusuma-plugin-sendkey](https://github.com/iberianpig/fusuma-plugin-sendkey) | Emulates keyboard events |
|
246
253
|
| [fusuma-plugin-wmctrl](https://github.com/iberianpig/fusuma-plugin-wmctrl) | Manages Window and Workspace |
|
247
254
|
| [fusuma-plugin-keypress](https://github.com/iberianpig/fusuma-plugin-keypress) | Detects gestures while pressing multiple keys |
|
255
|
+
| [fusuma-plugin-tap](https://github.com/iberianpig/fusuma-plugin-tap) | Detects Tap and Hold gestures |
|
256
|
+
|
257
|
+
## Tutorial Video
|
258
|
+
|
259
|
+
[![Multitouch Touchpad Gestures in Linux with Fusuma](http://img.youtube.com/vi/bn11Iwvf29I/0.jpg)](http://www.youtube.com/watch?v=bn11Iwvf29I "Multitouch Touchpad Gestures in Linux with Fusuma")
|
260
|
+
[Multitouch Touchpad Gestures in Linux with Fusuma](http://www.youtube.com/watch?v=bn11Iwvf29I) by [Eric Adams](https://www.youtube.com/user/igster75)
|
261
|
+
|
248
262
|
|
249
263
|
## Support
|
250
264
|
|
251
|
-
|
265
|
+
I'm a Freelance Engineer in Japan and working on these products after finishing my regular work or on my holidays.
|
266
|
+
Currently, my open-source contribution times is not enough.
|
267
|
+
If you like my work and want to contribute and become a sponsor, I will be able to focus on my projects.
|
268
|
+
|
269
|
+
* [GitHub Sponsors](https://github.com/sponsors/iberianpig) (Zero fee!)
|
270
|
+
* [Patreon](https://www.patreon.com/iberianpig)
|
271
|
+
|
252
272
|
|
253
273
|
## Contributing
|
254
274
|
|
data/lib/fusuma.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative './fusuma/version'
|
|
4
4
|
require_relative './fusuma/multi_logger'
|
5
5
|
require_relative './fusuma/config.rb'
|
6
6
|
require_relative './fusuma/device.rb'
|
7
|
+
require_relative './fusuma/libinput_command.rb'
|
7
8
|
require_relative './fusuma/plugin/manager.rb'
|
8
9
|
|
9
10
|
# this is top level module
|
@@ -47,7 +48,7 @@ module Fusuma
|
|
47
48
|
|
48
49
|
def print_version
|
49
50
|
MultiLogger.info "Fusuma: #{Fusuma::VERSION}"
|
50
|
-
MultiLogger.info "libinput: #{
|
51
|
+
MultiLogger.info "libinput: #{LibinputCommand.new.version}"
|
51
52
|
MultiLogger.info "OS: #{`uname -rsv`}".strip
|
52
53
|
MultiLogger.info "Distribution: #{`cat /etc/issue`}".strip
|
53
54
|
MultiLogger.info "Desktop session: #{`echo $DESKTOP_SESSION $XDG_SESSION_TYPE`}".strip
|
@@ -90,7 +91,7 @@ module Fusuma
|
|
90
91
|
parsed = parse(filtered) || next
|
91
92
|
buffered = buffer(parsed) || next
|
92
93
|
detected = detect(buffered) || next
|
93
|
-
merged = merge(detected)
|
94
|
+
merged = merge(detected) || next
|
94
95
|
execute(merged)
|
95
96
|
end
|
96
97
|
end
|
data/lib/fusuma/device.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative './multi_logger'
|
4
|
+
require_relative './libinput_command.rb'
|
5
|
+
|
3
6
|
module Fusuma
|
4
7
|
# detect input device
|
5
8
|
class Device
|
@@ -56,7 +59,7 @@ module Fusuma
|
|
56
59
|
# @return [Array]
|
57
60
|
def fetch_devices
|
58
61
|
line_parser = LineParser.new
|
59
|
-
|
62
|
+
LibinputCommand.new.list_devices do |line|
|
60
63
|
line_parser.push(line)
|
61
64
|
end
|
62
65
|
line_parser.generate_devices
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
module Fusuma
|
6
|
+
# Execute libinput command
|
7
|
+
class LibinputCommand
|
8
|
+
def initialize(libinput_options: [])
|
9
|
+
@libinput_options = libinput_options
|
10
|
+
end
|
11
|
+
|
12
|
+
# `libinput-list-devices` and `libinput-debug-events` are deprecated,
|
13
|
+
# use `libinput list-devices` and `libinput debug-events` from 1.8.
|
14
|
+
NEW_CLI_OPTION_VERSION = 1.8
|
15
|
+
|
16
|
+
# @return [Boolean]
|
17
|
+
def new_cli_option_available?
|
18
|
+
Gem::Version.new(version) >= Gem::Version.new(NEW_CLI_OPTION_VERSION)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [String]
|
22
|
+
def version
|
23
|
+
# versiom_command prints "1.6.3\n"
|
24
|
+
@version ||= `#{version_command}`.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
# @yieldparam [String] gives a line in libinput list-devices output to the block
|
28
|
+
def list_devices
|
29
|
+
cmd = list_devices_command
|
30
|
+
MultiLogger.debug(list_devices: cmd)
|
31
|
+
Open3.popen3(cmd) do |_i, o, _e, _w|
|
32
|
+
o.each { |line| yield(line) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @yieldparam [String] gives a line in libinput debug-events output to the block
|
37
|
+
def debug_events
|
38
|
+
prefix = 'stdbuf -oL --'
|
39
|
+
cmd = "#{prefix} #{debug_events_command} #{@libinput_options.join(' ')}".strip
|
40
|
+
MultiLogger.debug(debug_events: cmd)
|
41
|
+
Open3.popen3(cmd) do |_i, o, _e, _w|
|
42
|
+
o.each do |line|
|
43
|
+
yield(line.chomp)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [String] command
|
49
|
+
# @raise [SystemExit]
|
50
|
+
def version_command
|
51
|
+
if which('libinput')
|
52
|
+
'libinput --version'
|
53
|
+
elsif which('libinput-list-devices')
|
54
|
+
'libinput-list-devices --version'
|
55
|
+
else
|
56
|
+
MultiLogger.error 'install libinput-tools'
|
57
|
+
exit 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def list_devices_command
|
62
|
+
if new_cli_option_available?
|
63
|
+
'libinput list-devices'
|
64
|
+
else
|
65
|
+
'libinput-list-devices'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def debug_events_command
|
70
|
+
if new_cli_option_available?
|
71
|
+
'libinput debug-events'
|
72
|
+
else
|
73
|
+
'libinput-debug-events'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
# which in ruby: Checking if program exists in $PATH from ruby
|
80
|
+
# (https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby)
|
81
|
+
# Cross-platform way of finding an executable in the $PATH.
|
82
|
+
#
|
83
|
+
# which('ruby') #=> /usr/bin/ruby
|
84
|
+
# @return [String, nil]
|
85
|
+
def which(command)
|
86
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
87
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
88
|
+
exts.each do |ext|
|
89
|
+
exe = File.join(path, "#{command}#{ext}")
|
90
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative './input.rb'
|
4
|
-
require 'open3'
|
5
4
|
|
6
5
|
module Fusuma
|
7
6
|
module Plugin
|
@@ -19,77 +18,11 @@ module Fusuma
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def run
|
22
|
-
debug_events do |line|
|
21
|
+
LibinputCommand.new(libinput_options: libinput_options).debug_events do |line|
|
23
22
|
yield event(record: line)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
# `libinput-list-devices` and `libinput-debug-events` are deprecated,
|
28
|
-
# use `libinput list-devices` and `libinput debug-events` from 1.8.
|
29
|
-
NEW_CLI_OPTION_VERSION = 1.8
|
30
|
-
|
31
|
-
# @return [Boolean]
|
32
|
-
def new_cli_option_available?
|
33
|
-
Gem::Version.new(version) >= Gem::Version.new(NEW_CLI_OPTION_VERSION)
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [String]
|
37
|
-
def version
|
38
|
-
# versiom_command prints "1.6.3\n"
|
39
|
-
@version ||= `#{version_command}`.strip
|
40
|
-
end
|
41
|
-
|
42
|
-
# @yieldparam [String] gives a line in libinput list-devices output to the block
|
43
|
-
def list_devices
|
44
|
-
cmd = list_devices_command
|
45
|
-
MultiLogger.debug(list_devices: cmd)
|
46
|
-
Open3.popen3(cmd) do |_i, o, _e, _w|
|
47
|
-
o.each { |line| yield(line) }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# @yieldparam [String] gives a line in libinput debug-events output to the block
|
52
|
-
def debug_events
|
53
|
-
prefix = 'stdbuf -oL --'
|
54
|
-
options = [*libinput_options]
|
55
|
-
cmd = "#{prefix} #{debug_events_command} #{options.join(' ')}".strip
|
56
|
-
MultiLogger.debug(debug_events: cmd)
|
57
|
-
Open3.popen3(cmd) do |_i, o, _e, _w|
|
58
|
-
o.each do |line|
|
59
|
-
yield(line.chomp)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# @return [String] command
|
65
|
-
# @raise [SystemExit]
|
66
|
-
def version_command
|
67
|
-
if which('libinput')
|
68
|
-
'libinput --version'
|
69
|
-
elsif which('libinput-list-devices')
|
70
|
-
'libinput-list-devices --version'
|
71
|
-
else
|
72
|
-
MultiLogger.error 'install libinput-tools'
|
73
|
-
exit 1
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def list_devices_command
|
78
|
-
if new_cli_option_available?
|
79
|
-
'libinput list-devices'
|
80
|
-
else
|
81
|
-
'libinput-list-devices'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def debug_events_command
|
86
|
-
if new_cli_option_available?
|
87
|
-
'libinput debug-events'
|
88
|
-
else
|
89
|
-
'libinput-debug-events'
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
26
|
def libinput_options
|
94
27
|
device = ("--device='#{config_params(:device)}'" if config_params(:device))
|
95
28
|
enable_tap = '--enable-tap' if config_params(:'enable-tap')
|
@@ -104,25 +37,6 @@ module Fusuma
|
|
104
37
|
verbose
|
105
38
|
].compact
|
106
39
|
end
|
107
|
-
|
108
|
-
private
|
109
|
-
|
110
|
-
# which in ruby: Checking if program exists in $PATH from ruby
|
111
|
-
# (https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby)
|
112
|
-
# Cross-platform way of finding an executable in the $PATH.
|
113
|
-
#
|
114
|
-
# which('ruby') #=> /usr/bin/ruby
|
115
|
-
# @return [String, nil]
|
116
|
-
def which(command)
|
117
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
118
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
119
|
-
exts.each do |ext|
|
120
|
-
exe = File.join(path, "#{command}#{ext}")
|
121
|
-
return exe if File.executable?(exe) && !File.directory?(exe)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
nil
|
125
|
-
end
|
126
40
|
end
|
127
41
|
end
|
128
42
|
end
|
data/lib/fusuma/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/fusuma/config.yml
|
186
186
|
- lib/fusuma/config/index.rb
|
187
187
|
- lib/fusuma/device.rb
|
188
|
+
- lib/fusuma/libinput_command.rb
|
188
189
|
- lib/fusuma/multi_logger.rb
|
189
190
|
- lib/fusuma/plugin/base.rb
|
190
191
|
- lib/fusuma/plugin/buffers/buffer.rb
|