fusuma 3.10.0 → 3.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7161de044b786ed9f12f64be26a497307ba1ea87159760e68b5ac90d87ea1d73
4
- data.tar.gz: aa9359be7d9c0bcc6ca283ba5c2aa17b55f07424a26d3f22b056c47b924488bc
3
+ metadata.gz: 55410ba5fd5d7543fe4089aa09f2af2229400d49be8d9572f1e6d41af79b1079
4
+ data.tar.gz: fcf73fd3254b1f9ba58cf61ba5705bbbd76d8448e91a2d12a12fc08116325367
5
5
  SHA512:
6
- metadata.gz: 1187109a3b4b3ba67b35feaa274ab73a58dc3411ae8b3de6f62e5ef153c7ca8647383ae0cebeeb8e5632bd69ec0218477826e5e5aa4d32002233a87b521eba43
7
- data.tar.gz: eec0e66de8f07b7e64ffec123b16a1b51103701346819b0b048850d83e8bf8a78c020f3d51e889f7ff5474218d534a7e7e6bf834bac36c6ff739f279a06da4c8
6
+ metadata.gz: fac06a520334b1ff98e9467f06633e801c2bd86e56860232c54bfd0a36df2cec77bc8fa1f97a8ceafbb6561221fb5ea9bd4766e58e37b780c9ba450a8ec2fdd2
7
+ data.tar.gz: 28098f90c6aadef6f44f4f0cc6c3e8244e9921f9e70a1dc18293f9374d1e4d3a7c0d340458e2d758bfa9a5fb0e8c2fa124170f40e8c4b3fee03de142ed1c7196
data/README.md CHANGED
@@ -81,7 +81,7 @@ sudo apt-get install xdotool
81
81
  You need `libinput` release 1.0 or later. This is most probably installed by default on Manjaro
82
82
 
83
83
  ```sh
84
- sudo pacman -Syu libinput
84
+ sudo pacman -Syu libinput-tools
85
85
  ```
86
86
 
87
87
  #### 2. Install Ruby
data/lib/fusuma/device.rb CHANGED
@@ -41,31 +41,40 @@ module Fusuma
41
41
  def all
42
42
  @all ||= fetch_devices.partition do |d|
43
43
  d.capabilities.match?(/gesture/)
44
- end.flatten
44
+ end.flatten.tap do |devices|
45
+ log_if_changed(devices)
46
+ end
45
47
  end
46
48
 
47
- # @raise [SystemExit]
48
49
  # @return [Array]
49
50
  #: () -> Array[Device]
50
51
  def available
51
52
  @available ||= all.select(&:available).tap do |d|
52
53
  MultiLogger.debug(available_devices: d)
53
- raise "Touchpad is not found" if d.empty?
54
+ MultiLogger.warn("Touchpad is not found") if d.empty?
54
55
  end
55
- rescue RuntimeError => e
56
- # FIXME: should not exit without Runner class
57
- MultiLogger.error(e.message)
58
- exit 1
59
56
  end
60
57
 
61
58
  #: () -> nil
62
59
  def reset
63
60
  @all = nil
64
61
  @available = nil
62
+ @previous_device_ids = nil
65
63
  end
66
64
 
67
65
  private
68
66
 
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
+
69
78
  # @return [Array]
70
79
  #: () -> Array[Device]
71
80
  def fetch_devices
@@ -39,7 +39,10 @@ module Fusuma
39
39
  #: () { (String) -> void } -> void
40
40
  def list_devices(&block)
41
41
  cmd = list_devices_command
42
- MultiLogger.debug(list_devices: cmd)
42
+ unless @logged_list_devices
43
+ MultiLogger.debug(list_devices: cmd)
44
+ @logged_list_devices = true
45
+ end
43
46
  o, _, s = Open3.capture3(cmd)
44
47
 
45
48
  unless s.success?
@@ -9,6 +9,7 @@ module Fusuma
9
9
  # Create a Plugin Class with extending this class
10
10
  class Base
11
11
  # when inherited from subclass
12
+ #: (Class) -> Array[untyped]
12
13
  def self.inherited(subclass)
13
14
  super
14
15
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "filter"
4
4
  require_relative "../../device"
5
+ require_relative "../../multi_logger"
5
6
 
6
7
  module Fusuma
7
8
  module Plugin
@@ -72,12 +73,13 @@ module Fusuma
72
73
  #: () -> Array[Device]
73
74
  def all
74
75
  @all ||= if @name_patterns.empty?
75
- Device.available
76
+ Device.all.select(&:available)
76
77
  else
77
78
  Device.all.select do |device|
78
79
  match_pattern?(device.name)
79
80
  end
80
81
  end.tap do |devices|
82
+ MultiLogger.debug(available_devices: devices)
81
83
  print_not_found_messages if devices.empty?
82
84
  end
83
85
  end
@@ -33,6 +33,7 @@ module Fusuma
33
33
  end
34
34
 
35
35
  # @return [Array<String>] paths of external plugins (installed by gem)
36
+ #: () -> Array[untyped]
36
37
  def fusuma_external_plugin_paths
37
38
  @_fusuma_external_plugin_paths ||=
38
39
  Gem.find_latest_files(search_key).map do |siblings_plugin|
@@ -87,6 +88,7 @@ module Fusuma
87
88
 
88
89
  # @param plugin_class [Class]
89
90
  # return [Hash, false]
91
+ #: (plugin_class: Class, plugin_path: String) -> Array[untyped]?
90
92
  def add(plugin_class:, plugin_path:)
91
93
  return false if exist?(plugin_class: plugin_class, plugin_path: plugin_path)
92
94
 
@@ -138,6 +140,7 @@ module Fusuma
138
140
 
139
141
  # @param plugin_class [Class]
140
142
  # @return [Boolean]
143
+ #: (plugin_class: Class, plugin_path: String) -> bool
141
144
  def exist?(plugin_class:, plugin_path:)
142
145
  return false if load_paths.include?(plugin_path)
143
146
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = "3.10.0"
4
+ VERSION = "3.11.0"
5
5
  end
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.10.0
4
+ version: 3.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-19 00:00:00.000000000 Z
11
+ date: 2026-01-09 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