fusuma 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/exe/fusuma +31 -25
- data/lib/fusuma.rb +26 -13
- data/lib/fusuma/device.rb +16 -1
- data/lib/fusuma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 006b0257ed698f1e84f48003c23dbe5090ff1a77
|
4
|
+
data.tar.gz: 8acb3579213176b578501b6c13be87ec2b2cef47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcbbae537901fe01b32a655a236ba665317a0f6f56193d97a8b9834efab141a5405f0d0375a091b81a493d7438787080076896aa2f92c5993a3194c9a45177f
|
7
|
+
data.tar.gz: d4295e32fd124ff621d6cf180f0250fe0cedae70eb168f0e13da6117573d0270dec8ed3188b6907f93dd7df922e6c98cc37c4f70a00968529540c10623fea48a
|
data/README.md
CHANGED
@@ -126,7 +126,9 @@ If the swipe's interval is `0.5`, shorten swipe-interval by half to recognize a
|
|
126
126
|
|
127
127
|
* `-c`, `--config=path/to/file` : Use an alternative config file
|
128
128
|
* `-d`, `--daemon` : Daemonize process
|
129
|
+
* `-l`, `--list-devices` : List available devices
|
129
130
|
* `-v`, `--verbose` : Show details about the results of running fusuma
|
131
|
+
* `--device=event14` : Open the given device only
|
130
132
|
* `--version` : Show fusuma version
|
131
133
|
|
132
134
|
## Contributing
|
data/exe/fusuma
CHANGED
@@ -4,31 +4,37 @@ require 'optparse'
|
|
4
4
|
require_relative '../lib/fusuma'
|
5
5
|
|
6
6
|
option = {}
|
7
|
-
OptionParser.new
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
7
|
+
opt = OptionParser.new
|
8
|
+
|
9
|
+
opt.on('-c', '--config=path/to/file',
|
10
|
+
'Use an alternative config file') do |v|
|
11
|
+
option[:config_path] = v
|
12
|
+
end
|
13
|
+
|
14
|
+
opt.on('-d', '--daemon',
|
15
|
+
'Daemonize process') do |v|
|
16
|
+
option[:daemon] = v
|
17
|
+
end
|
18
|
+
|
19
|
+
opt.on('-l', '--list-devices',
|
20
|
+
'List available devices') do |v|
|
21
|
+
option[:list] = v
|
22
|
+
end
|
23
|
+
|
24
|
+
opt.on('--device=event14',
|
25
|
+
'Open the given device only') do |v|
|
26
|
+
option[:device] = v
|
27
|
+
end
|
28
|
+
|
29
|
+
opt.on('-v', '--verbose',
|
30
|
+
'Show details about the results of running fusuma') do |v|
|
31
|
+
option[:verbose] = v
|
32
32
|
end
|
33
33
|
|
34
|
+
opt.on('--version', 'Show fusuma version') do |v|
|
35
|
+
option[:version] = v
|
36
|
+
end
|
37
|
+
|
38
|
+
opt.parse!(ARGV)
|
39
|
+
|
34
40
|
Fusuma::Runner.run(option)
|
data/lib/fusuma.rb
CHANGED
@@ -31,27 +31,40 @@ module Fusuma
|
|
31
31
|
Signal.trap('TERM') { puts exit } # Trap `Kill `
|
32
32
|
end
|
33
33
|
|
34
|
+
def read_options(option)
|
35
|
+
print_version && exit(0) if option[:version]
|
36
|
+
print_device_list if option[:list]
|
37
|
+
reload_custom_config(option[:config_path])
|
38
|
+
debug_mode if option[:verbose]
|
39
|
+
Device.given_device = option[:device]
|
40
|
+
Process.daemon if option[:daemon]
|
41
|
+
end
|
42
|
+
|
34
43
|
def print_version
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
44
|
+
MultiLogger.info '---------------------------------------------'
|
45
|
+
MultiLogger.info "Fusuma: #{Fusuma::VERSION}"
|
46
|
+
MultiLogger.info "libinput: #{LibinputCommands.new.version}"
|
47
|
+
MultiLogger.info "OS: #{`uname -rsv`}".strip
|
48
|
+
MultiLogger.info "Distribution: #{`cat /etc/issue`}".strip
|
49
|
+
MultiLogger.info "Desktop session: #{`echo $DESKTOP_SESSION`}".strip
|
50
|
+
MultiLogger.info '---------------------------------------------'
|
42
51
|
end
|
43
52
|
|
44
|
-
def
|
53
|
+
def print_device_list
|
54
|
+
puts Device.names
|
55
|
+
exit(0)
|
56
|
+
end
|
57
|
+
|
58
|
+
def reload_custom_config(config_path = nil)
|
59
|
+
return unless config_path
|
45
60
|
MultiLogger.info "use custom path: #{config_path}"
|
46
61
|
Config.instance.custom_path = config_path
|
47
62
|
Config.reload
|
48
63
|
end
|
49
64
|
|
50
|
-
def
|
51
|
-
print_version
|
52
|
-
|
53
|
-
MultiLogger.instance.debug_mode = true if option[:verbose]
|
54
|
-
Process.daemon if option[:daemon]
|
65
|
+
def debug_mode
|
66
|
+
print_version
|
67
|
+
MultiLogger.instance.debug_mode = true
|
55
68
|
end
|
56
69
|
end
|
57
70
|
|
data/lib/fusuma/device.rb
CHANGED
@@ -5,7 +5,7 @@ module Fusuma
|
|
5
5
|
attr_writer :names
|
6
6
|
|
7
7
|
def names
|
8
|
-
return @names unless
|
8
|
+
return @names unless no_name?
|
9
9
|
device_names = fetch_device_names
|
10
10
|
MultiLogger.debug(device_names: device_names)
|
11
11
|
raise 'Touchpad is not found' if device_names.empty?
|
@@ -15,8 +15,23 @@ module Fusuma
|
|
15
15
|
exit 1
|
16
16
|
end
|
17
17
|
|
18
|
+
# @params [String]
|
19
|
+
def given_device=(name)
|
20
|
+
return if name.nil?
|
21
|
+
if names.include? name
|
22
|
+
self.names = [name]
|
23
|
+
return
|
24
|
+
end
|
25
|
+
MultiLogger.error("Device #{name} is not found")
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
18
29
|
private
|
19
30
|
|
31
|
+
def no_name?
|
32
|
+
@names.nil? || @names.empty?
|
33
|
+
end
|
34
|
+
|
20
35
|
# @return [Array]
|
21
36
|
def fetch_device_names
|
22
37
|
[].tap do |devices|
|
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: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|