fusuma 1.10.2 → 1.11.1
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/.rubocop.yml +4 -0
- data/CHANGELOG.md +37 -0
- data/lib/fusuma.rb +0 -2
- data/lib/fusuma/config.rb +34 -7
- data/lib/fusuma/config/yaml_duplication_checker.rb +42 -0
- data/lib/fusuma/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd9b74b06494e85c0caf6250e0dfeed80c37187098982b4f32c2dd8e727732fb
|
4
|
+
data.tar.gz: eb8c3d19693570b77b26519d7296856480342eec3eba0205ed970e01a4b46a16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abe0b55ab9f332d3f67c423b0890135973d57a4cf8b7d6fafc7b01b44874c2489b6752fcb7a66d0b0a625c612879e35ce7d11b6a3b5ce485711b84e8f45e5279
|
7
|
+
data.tar.gz: 323c35769c6f9827f8a94532a4dd10a25facf6bc6858d85b2b6540a6d78064e9003d4ccb83f4914f214aa6523cea8878b5f63abbe113211b1b0900ce0e203521
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.11.0](https://github.com/iberianpig/fusuma/tree/v1.11.0) (2020-07-25)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.2...v1.11.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Feature/yaml check [\#193](https://github.com/iberianpig/fusuma/pull/193) ([iberianpig](https://github.com/iberianpig))
|
10
|
+
|
11
|
+
## [v1.10.2](https://github.com/iberianpig/fusuma/tree/v1.10.2) (2020-07-23)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.1...v1.10.2)
|
14
|
+
|
15
|
+
**Closed issues:**
|
16
|
+
|
17
|
+
- Gestures from libinput are not recognised [\#192](https://github.com/iberianpig/fusuma/issues/192)
|
18
|
+
- Vertical 4 finger swipe and rotation not recognised [\#189](https://github.com/iberianpig/fusuma/issues/189)
|
19
|
+
- Pinch in gesture not recognized in Popos 20.04 \(Ubuntu 20.04\) [\#184](https://github.com/iberianpig/fusuma/issues/184)
|
20
|
+
- Fusuma crashes while switching between workspaces on KDE Plasma [\#181](https://github.com/iberianpig/fusuma/issues/181)
|
21
|
+
- Window Prev/Next moves desktop environment when no active window [\#178](https://github.com/iberianpig/fusuma/issues/178)
|
22
|
+
- Add ydotool to docs. [\#177](https://github.com/iberianpig/fusuma/issues/177)
|
23
|
+
- Can't use alternative .config.yml [\#176](https://github.com/iberianpig/fusuma/issues/176)
|
24
|
+
- Fusuma stops working sometimes [\#175](https://github.com/iberianpig/fusuma/issues/175)
|
25
|
+
- Pinch \(2, in\) does not work. [\#174](https://github.com/iberianpig/fusuma/issues/174)
|
26
|
+
|
27
|
+
**Merged pull requests:**
|
28
|
+
|
29
|
+
- 177. Add ydootool to docs. [\#179](https://github.com/iberianpig/fusuma/pull/179) ([mattdemarillac](https://github.com/mattdemarillac))
|
30
|
+
|
31
|
+
## [v1.10.1](https://github.com/iberianpig/fusuma/tree/v1.10.1) (2020-05-15)
|
32
|
+
|
33
|
+
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.10.0...v1.10.1)
|
34
|
+
|
35
|
+
**Closed issues:**
|
36
|
+
|
37
|
+
- Some gestures are not always recognized [\#172](https://github.com/iberianpig/fusuma/issues/172)
|
38
|
+
- Unable to reprogram Pinch [\#171](https://github.com/iberianpig/fusuma/issues/171)
|
39
|
+
|
3
40
|
## [v1.10.0](https://github.com/iberianpig/fusuma/tree/v1.10.0) (2020-05-04)
|
4
41
|
|
5
42
|
[Full Changelog](https://github.com/iberianpig/fusuma/compare/v1.9.0...v1.10.0)
|
data/lib/fusuma.rb
CHANGED
data/lib/fusuma/config.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative './multi_logger.rb'
|
4
4
|
require_relative './config/index.rb'
|
5
|
+
require_relative './config/yaml_duplication_checker.rb'
|
5
6
|
require 'singleton'
|
6
7
|
require 'yaml'
|
7
8
|
|
@@ -9,6 +10,9 @@ require 'yaml'
|
|
9
10
|
module Fusuma
|
10
11
|
# read keymap from yaml file
|
11
12
|
class Config
|
13
|
+
class NotFoundError < StandardError; end
|
14
|
+
class InvalidFileError < StandardError; end
|
15
|
+
|
12
16
|
include Singleton
|
13
17
|
|
14
18
|
class << self
|
@@ -28,7 +32,6 @@ module Fusuma
|
|
28
32
|
@custom_path = nil
|
29
33
|
@cache = nil
|
30
34
|
@keymap = nil
|
31
|
-
reload
|
32
35
|
end
|
33
36
|
|
34
37
|
def custom_path=(new_path)
|
@@ -37,12 +40,33 @@ module Fusuma
|
|
37
40
|
end
|
38
41
|
|
39
42
|
def reload
|
40
|
-
@cache
|
41
|
-
|
42
|
-
MultiLogger.info "reload config
|
43
|
+
@cache = nil
|
44
|
+
path = find_filepath
|
45
|
+
MultiLogger.info "reload config: #{path}"
|
46
|
+
@keymap = validate(path)
|
43
47
|
self
|
44
48
|
end
|
45
49
|
|
50
|
+
# @return [Hash]
|
51
|
+
# @raise [InvalidError]
|
52
|
+
def validate(path)
|
53
|
+
duplicates = []
|
54
|
+
YAMLDuplicationChecker.check(File.read(path), path) do |ignored, duplicate|
|
55
|
+
MultiLogger.error "#{path}: #{ignored.value} is duplicated"
|
56
|
+
duplicates << duplicate.value
|
57
|
+
end
|
58
|
+
raise InvalidFileError, "Detect duplicate keys #{duplicates}" unless duplicates.empty?
|
59
|
+
|
60
|
+
yaml = YAML.load_file(path)
|
61
|
+
|
62
|
+
raise InvalidFileError, 'Invaid YAML file' unless yaml.is_a? Hash
|
63
|
+
|
64
|
+
yaml.deep_symbolize_keys
|
65
|
+
rescue StandardError => e
|
66
|
+
MultiLogger.error e.message
|
67
|
+
raise InvalidFileError, e.message
|
68
|
+
end
|
69
|
+
|
46
70
|
# @param index [Index]
|
47
71
|
def search(index)
|
48
72
|
cache(index.cache_key) do
|
@@ -64,13 +88,16 @@ module Fusuma
|
|
64
88
|
|
65
89
|
private
|
66
90
|
|
67
|
-
def
|
91
|
+
def find_filepath
|
68
92
|
filename = 'fusuma/config.yml'
|
69
|
-
if custom_path
|
70
|
-
expand_custom_path
|
93
|
+
if custom_path
|
94
|
+
return expand_custom_path if File.exist?(expand_custom_path)
|
95
|
+
|
96
|
+
raise NotFoundError, "#{expand_custom_path} is NOT FOUND"
|
71
97
|
elsif File.exist?(expand_config_path(filename))
|
72
98
|
expand_config_path(filename)
|
73
99
|
else
|
100
|
+
MultiLogger.warn "config file: #{expand_config_path(filename)} is NOT FOUND"
|
74
101
|
expand_default_path(filename)
|
75
102
|
end
|
76
103
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Fusuma
|
4
|
+
class Config
|
5
|
+
# ref: https://github.com/rubocop-hq/rubocop/blob/97e4ffc8a71e9e5239a927c6a534dfc1e0da917f/lib/rubocop/yaml_duplication_checker.rb
|
6
|
+
# Find duplicated keys from YAML.
|
7
|
+
module YAMLDuplicationChecker
|
8
|
+
def self.check(yaml_string, filename, &on_duplicated)
|
9
|
+
# Ruby 2.6+
|
10
|
+
tree = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0')
|
11
|
+
# Specify filename to display helpful message when it raises
|
12
|
+
# an error.
|
13
|
+
YAML.parse(yaml_string, filename: filename)
|
14
|
+
else
|
15
|
+
YAML.parse(yaml_string, filename)
|
16
|
+
end
|
17
|
+
return unless tree
|
18
|
+
|
19
|
+
traverse(tree, &on_duplicated)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.traverse(tree, &on_duplicated)
|
23
|
+
case tree
|
24
|
+
when Psych::Nodes::Mapping
|
25
|
+
tree.children.each_slice(2).with_object([]) do |(key, value), keys|
|
26
|
+
exist = keys.find { |key2| key2.value == key.value }
|
27
|
+
on_duplicated.call(exist, key) if exist
|
28
|
+
keys << key
|
29
|
+
traverse(value, &on_duplicated)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
children = tree.children
|
33
|
+
return unless children
|
34
|
+
|
35
|
+
children.each { |c| traverse(c, &on_duplicated) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private_class_method :traverse
|
40
|
+
end
|
41
|
+
end
|
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.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/fusuma/config.rb
|
201
201
|
- lib/fusuma/config.yml
|
202
202
|
- lib/fusuma/config/index.rb
|
203
|
+
- lib/fusuma/config/yaml_duplication_checker.rb
|
203
204
|
- lib/fusuma/device.rb
|
204
205
|
- lib/fusuma/environment.rb
|
205
206
|
- lib/fusuma/libinput_command.rb
|
@@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
248
|
- !ruby/object:Gem::Version
|
248
249
|
version: '0'
|
249
250
|
requirements: []
|
250
|
-
rubygems_version: 3.0.
|
251
|
+
rubygems_version: 3.2.0.rc.1
|
251
252
|
signing_key:
|
252
253
|
specification_version: 4
|
253
254
|
summary: Multitouch gestures with libinput dirver on X11, Linux
|