fusuma 3.11.0 → 3.11.2
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/bin/console +4 -4
- data/exe/fusuma +15 -15
- data/lib/fusuma/config/searcher.rb +6 -8
- data/lib/fusuma/device.rb +1 -15
- data/lib/fusuma/plugin/base.rb +10 -6
- data/lib/fusuma/plugin/detectors/detector.rb +1 -0
- data/lib/fusuma/plugin/inputs/timer_input.rb +1 -0
- data/lib/fusuma/plugin/manager.rb +17 -7
- data/lib/fusuma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 515a37e5be710edfd3beda67d734a49ad516dd9c01654afb0bf0d3145ab20c6d
|
|
4
|
+
data.tar.gz: ab7ab39b5097de21b58e403d3b4cdcebc3fab41327ddf0a5fb0c7a3ae6d531a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f84ab4bddf97600928b348dec236008205b7261a90bdf87ee8f6409f8524864ffe587ace33569b64b8ecac773a02a58c3776908186b3a08298dac55f9b0a0ed
|
|
7
|
+
data.tar.gz: 1c2b88e154697a95e96ce8e4b4df1b712f80ac2e27d63ac06c7d6f5824e566d1479df51975241277b881a537a1fd883364e19ed4d9338a9465d39438ed644370
|
data/bin/console
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require
|
|
5
|
-
require
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "fusuma"
|
|
6
6
|
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -10,9 +10,9 @@ require 'fusuma'
|
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
11
|
|
|
12
12
|
def reload!(print = true)
|
|
13
|
-
puts
|
|
13
|
+
puts "Reloading ..." if print
|
|
14
14
|
# Main project directory.
|
|
15
|
-
root_dir = File.expand_path(
|
|
15
|
+
root_dir = File.expand_path("..", __dir__)
|
|
16
16
|
# Directories within the project that should be reloaded.
|
|
17
17
|
reload_dirs = %w[lib]
|
|
18
18
|
# Loop through and reload every file in all relevant project directories.
|
data/exe/fusuma
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require
|
|
5
|
-
require_relative
|
|
4
|
+
require "optparse"
|
|
5
|
+
require_relative "../lib/fusuma"
|
|
6
6
|
|
|
7
7
|
option = {}
|
|
8
8
|
opt = OptionParser.new
|
|
9
9
|
|
|
10
|
-
opt.on(
|
|
11
|
-
|
|
10
|
+
opt.on("-c", "--config=path/to/file",
|
|
11
|
+
"Use an alternative config file") do |v|
|
|
12
12
|
option[:config_path] = v
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
opt.on(
|
|
16
|
-
|
|
15
|
+
opt.on("-d", "--daemon",
|
|
16
|
+
"Daemonize process") do |v|
|
|
17
17
|
option[:daemon] = v
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
opt.on(
|
|
21
|
-
|
|
20
|
+
opt.on("-l", "--list-devices",
|
|
21
|
+
"List available devices") do |v|
|
|
22
22
|
option[:list] = v
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
opt.on(
|
|
26
|
-
|
|
25
|
+
opt.on("--log=path/to/file",
|
|
26
|
+
"Print logs to file") do |v|
|
|
27
27
|
option[:log_filepath] = v
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
opt.on(
|
|
30
|
+
opt.on("--show-config", "Show config as YAML format which is loaded internally") do |v|
|
|
31
31
|
option[:show_config] = v
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
opt.on('--device="Device name"',
|
|
35
|
-
|
|
35
|
+
"Open the given device only (DEPRECATED)") do |v|
|
|
36
36
|
option[:device] = v
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
opt.on(
|
|
40
|
-
|
|
39
|
+
opt.on("-v", "--verbose",
|
|
40
|
+
"Show details about the results of running fusuma") do |v|
|
|
41
41
|
option[:verbose] = v
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
opt.on(
|
|
44
|
+
opt.on("--version", "Show fusuma version") do |v|
|
|
45
45
|
option[:version] = v
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -19,18 +19,16 @@ module Fusuma
|
|
|
19
19
|
def search(index, location:)
|
|
20
20
|
key = index.keys.first
|
|
21
21
|
return location if key.nil?
|
|
22
|
-
|
|
23
22
|
return nil if location.nil?
|
|
24
|
-
|
|
25
23
|
return nil unless location.is_a?(Hash)
|
|
26
24
|
|
|
27
|
-
next_index = Index.new(
|
|
25
|
+
next_index = Index.new(index.keys.drop(1))
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
next_location_cadidates(location, key).each do |next_location|
|
|
28
|
+
result = search(next_index, location: next_location)
|
|
29
|
+
return result if result
|
|
32
30
|
end
|
|
33
|
-
|
|
31
|
+
nil
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
#: (Fusuma::Config::Index, location: Array[untyped], context: Hash[untyped, untyped] | nil) -> untyped
|
|
@@ -77,7 +75,7 @@ module Fusuma
|
|
|
77
75
|
def next_location_cadidates(location, key)
|
|
78
76
|
[
|
|
79
77
|
location[key.symbol],
|
|
80
|
-
key.skippable
|
|
78
|
+
key.skippable ? location : nil
|
|
81
79
|
].compact
|
|
82
80
|
end
|
|
83
81
|
|
data/lib/fusuma/device.rb
CHANGED
|
@@ -41,9 +41,7 @@ module Fusuma
|
|
|
41
41
|
def all
|
|
42
42
|
@all ||= fetch_devices.partition do |d|
|
|
43
43
|
d.capabilities.match?(/gesture/)
|
|
44
|
-
end.flatten
|
|
45
|
-
log_if_changed(devices)
|
|
46
|
-
end
|
|
44
|
+
end.flatten
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
# @return [Array]
|
|
@@ -59,22 +57,10 @@ module Fusuma
|
|
|
59
57
|
def reset
|
|
60
58
|
@all = nil
|
|
61
59
|
@available = nil
|
|
62
|
-
@previous_device_ids = nil
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
private
|
|
66
63
|
|
|
67
|
-
# Log device list only when it changes
|
|
68
|
-
# @param devices [Array<Device>]
|
|
69
|
-
#: (Array[Device]) -> void
|
|
70
|
-
def log_if_changed(devices)
|
|
71
|
-
device_ids = devices.map(&:id).sort
|
|
72
|
-
return if @previous_device_ids == device_ids
|
|
73
|
-
|
|
74
|
-
MultiLogger.debug(detected_devices: devices.map { |d| {id: d.id, name: d.name} })
|
|
75
|
-
@previous_device_ids = device_ids
|
|
76
|
-
end
|
|
77
|
-
|
|
78
64
|
# @return [Array]
|
|
79
65
|
#: () -> Array[Device]
|
|
80
66
|
def fetch_devices
|
data/lib/fusuma/plugin/base.rb
CHANGED
|
@@ -8,8 +8,8 @@ module Fusuma
|
|
|
8
8
|
module Plugin
|
|
9
9
|
# Create a Plugin Class with extending this class
|
|
10
10
|
class Base
|
|
11
|
-
# when
|
|
12
|
-
|
|
11
|
+
# Callback when a subclass inherits from this class.
|
|
12
|
+
# Registers the subclass with the plugin manager.
|
|
13
13
|
def self.inherited(subclass)
|
|
14
14
|
super
|
|
15
15
|
|
|
@@ -18,7 +18,11 @@ module Fusuma
|
|
|
18
18
|
raise "Plugin class #{subclass.name} must be defined in a file."
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
subclass_path = locations.first
|
|
21
|
+
subclass_path = locations.first&.path
|
|
22
|
+
if subclass_path.nil?
|
|
23
|
+
raise "Plugin class #{subclass.name} must have a valid file path."
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
Manager.add(plugin_class: subclass, plugin_path: subclass_path)
|
|
23
27
|
end
|
|
24
28
|
|
|
@@ -29,13 +33,12 @@ module Fusuma
|
|
|
29
33
|
end
|
|
30
34
|
|
|
31
35
|
# @abstract override `#shutdown` to implement
|
|
32
|
-
#: () ->
|
|
36
|
+
#: () -> void
|
|
33
37
|
def shutdown
|
|
34
38
|
end
|
|
35
39
|
|
|
36
40
|
# config parameter name and Type of the value of parameter
|
|
37
41
|
# @return [Hash]
|
|
38
|
-
#: () -> Hash[Symbol, Array[Class] | Class]
|
|
39
42
|
def config_param_types
|
|
40
43
|
raise NotImplementedError, "override #{self.class.name}##{__method__}"
|
|
41
44
|
end
|
|
@@ -43,7 +46,8 @@ module Fusuma
|
|
|
43
46
|
# @param key [Symbol]
|
|
44
47
|
# @param base [Config::Index]
|
|
45
48
|
# @return [Object]
|
|
46
|
-
#: (
|
|
49
|
+
#: () -> Hash[untyped, untyped]
|
|
50
|
+
#: (Symbol) -> untyped
|
|
47
51
|
def config_params(key = nil)
|
|
48
52
|
@config_params ||= {}
|
|
49
53
|
if @config_params["#{config_index.cache_key},#{key}"]
|
|
@@ -86,9 +86,13 @@ module Fusuma
|
|
|
86
86
|
# Detectors::PinchDetector,
|
|
87
87
|
# Detectors::SwipeDetector]}
|
|
88
88
|
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
|
|
89
|
+
# Register a plugin class with the manager.
|
|
90
|
+
# @param plugin_class [Class] the plugin class to register
|
|
91
|
+
# @param plugin_path [String] the file path of the plugin
|
|
92
|
+
# @return [false] if plugin already exists
|
|
93
|
+
# @return [nil] if search_key was already required
|
|
94
|
+
# @return [Array<String>] loaded plugin paths from gems
|
|
95
|
+
#: (plugin_class: Class, plugin_path: String) -> (Array[String] | false | nil)
|
|
92
96
|
def add(plugin_class:, plugin_path:)
|
|
93
97
|
return false if exist?(plugin_class: plugin_class, plugin_path: plugin_path)
|
|
94
98
|
|
|
@@ -110,7 +114,7 @@ module Fusuma
|
|
|
110
114
|
manager.require_siblings_from_gems
|
|
111
115
|
end
|
|
112
116
|
|
|
113
|
-
#: () ->
|
|
117
|
+
#: () -> bool
|
|
114
118
|
def require_base_plugins
|
|
115
119
|
require_relative "base"
|
|
116
120
|
require_relative "events/event"
|
|
@@ -122,7 +126,7 @@ module Fusuma
|
|
|
122
126
|
require_relative "executors/executor"
|
|
123
127
|
end
|
|
124
128
|
|
|
125
|
-
#: () -> Hash[
|
|
129
|
+
#: () -> Hash[String, Array[Class]]
|
|
126
130
|
def plugins
|
|
127
131
|
@plugins ||= {}
|
|
128
132
|
end
|
|
@@ -138,10 +142,16 @@ module Fusuma
|
|
|
138
142
|
@load_paths ||= []
|
|
139
143
|
end
|
|
140
144
|
|
|
141
|
-
#
|
|
142
|
-
#
|
|
145
|
+
# Check if a plugin class is already registered.
|
|
146
|
+
# Note: This intentionally returns false if only the path is registered,
|
|
147
|
+
# allowing multiple plugin classes from the same file (e.g., subclasses).
|
|
148
|
+
# @param plugin_class [Class] the plugin class to check
|
|
149
|
+
# @param plugin_path [String] the file path of the plugin (not used for existence check)
|
|
150
|
+
# @return [Boolean] true if plugin class is already registered
|
|
143
151
|
#: (plugin_class: Class, plugin_path: String) -> bool
|
|
144
152
|
def exist?(plugin_class:, plugin_path:)
|
|
153
|
+
# Skip existence check if path is already in load_paths
|
|
154
|
+
# This allows multiple classes from the same file to be registered
|
|
145
155
|
return false if load_paths.include?(plugin_path)
|
|
146
156
|
|
|
147
157
|
base = plugin_class.superclass.name
|
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: 3.11.
|
|
4
|
+
version: 3.11.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- iberianpig
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
|
|
14
14
|
on Linux able to recognize swipes or pinchs and assign command to them. Read installation
|