fusuma 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ee3a00540af361bdf6fc271b075bc2582f165c66
4
- data.tar.gz: 12de700700324a2f55bc6554df3b3e1b6c0682a6
2
+ SHA256:
3
+ metadata.gz: ac4c95b3576fd59ee15c871707789a3140516ba87e2356780d560953f0e36a70
4
+ data.tar.gz: 9342d8e745074e23e7972694ba506f5ca6b5e41e9a5a7a1ec78f8ce5be48abc3
5
5
  SHA512:
6
- metadata.gz: 777ed1969b9f371111405aa4d23779ff43c241da41e883e045ae58b182fbd8cd1ec1bf63eac4e04cff6e7dd4002c33a46cef0d3e1b27108cda288a4f6958b4e3
7
- data.tar.gz: f0a43e7ad1e65a5ae79f0d469ede2672700be54307b3ae7ff4e41872e0b31f810d95b9e3d6cb1a6c057ea33d5d32f13750cd34add572cd4eceecf81b73648d08
6
+ metadata.gz: 7c909bda16f03e93c558d885f612f17b9905fa7ce99f41318dfe75e0e9400ca2164dea526937b2d85876bb0a11e0f7bc2c1ba9066c0dfb02fe3d2a861f698cab
7
+ data.tar.gz: aea1580e411f3ed6b139de5277cbe9d1cb3c6234902ca4ab60a8e1986230a2698ce0efb0283e9c8a8715b88b8a3f4115d5caac4198bc83e893864bb658d86a81
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  Metrics/ModuleLength:
2
4
  Exclude:
3
5
  - "**/*_spec.rb"
@@ -0,0 +1,94 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-05-24 12:59:49 +0900 using RuboCop version 0.70.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
12
+ # SupportedHashRocketStyles: key, separator, table
13
+ # SupportedColonStyles: key, separator, table
14
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
15
+ Layout/AlignHash:
16
+ Exclude:
17
+ - 'spec/lib/config_spec.rb'
18
+
19
+ # Offense count: 20
20
+ # Cop supports --auto-correct.
21
+ Layout/EmptyLineAfterGuardClause:
22
+ Exclude:
23
+ - 'lib/fusuma.rb'
24
+ - 'lib/fusuma/command_executor.rb'
25
+ - 'lib/fusuma/config.rb'
26
+ - 'lib/fusuma/device.rb'
27
+ - 'lib/fusuma/event_stack.rb'
28
+ - 'lib/fusuma/gesture_event.rb'
29
+ - 'lib/fusuma/libinput_commands.rb'
30
+ - 'lib/fusuma/multi_logger.rb'
31
+ - 'lib/fusuma/pinch.rb'
32
+ - 'lib/fusuma/swipe.rb'
33
+
34
+ # Offense count: 1
35
+ # Cop supports --auto-correct.
36
+ # Configuration parameters: PreferredName.
37
+ Naming/RescuedExceptionsVariableName:
38
+ Exclude:
39
+ - 'lib/fusuma/device.rb'
40
+
41
+ # Offense count: 1
42
+ # Cop supports --auto-correct.
43
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
44
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
45
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
46
+ # FunctionalMethods: let, let!, subject, watch
47
+ # IgnoredMethods: lambda, proc, it
48
+ Style/BlockDelimiters:
49
+ Exclude:
50
+ - 'lib/fusuma/command_executor.rb'
51
+
52
+ # Offense count: 23
53
+ # Cop supports --auto-correct.
54
+ # Configuration parameters: EnforcedStyle.
55
+ # SupportedStyles: always, never
56
+ Style/FrozenStringLiteralComment:
57
+ Enabled: false
58
+
59
+ # Offense count: 3
60
+ # Cop supports --auto-correct.
61
+ # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
62
+ # SupportedStyles: predicate, comparison
63
+ Style/NumericPredicate:
64
+ Exclude:
65
+ - 'spec/**/*'
66
+ - 'lib/fusuma/pinch.rb'
67
+ - 'lib/fusuma/swipe.rb'
68
+
69
+ # Offense count: 1
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
72
+ # Whitelist: present?, blank?, presence, try, try!
73
+ Style/SafeNavigation:
74
+ Exclude:
75
+ - 'lib/fusuma.rb'
76
+
77
+ # Offense count: 1
78
+ # Cop supports --auto-correct.
79
+ Style/UnneededInterpolation:
80
+ Exclude:
81
+ - 'lib/fusuma/command_executor.rb'
82
+
83
+ # Offense count: 1
84
+ # Cop supports --auto-correct.
85
+ Style/UnneededPercentQ:
86
+ Exclude:
87
+ - 'spec/lib/command_executor_spec.rb'
88
+
89
+ # Offense count: 3
90
+ # Cop supports --auto-correct.
91
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
92
+ # URISchemes: http, https
93
+ Metrics/LineLength:
94
+ Max: 87
@@ -1,9 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.1
5
- - 2.2
6
4
  - 2.3.1
7
5
  - 2.4
8
6
  - 2.5
9
- before_install: gem install bundler -v 1.13.2
7
+ before_install:
8
+ - travis_retry gem update --system || travis_retry gem update --system 2.7.8
9
+ - travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
data/README.md CHANGED
@@ -94,12 +94,13 @@ swipe:
94
94
  down:
95
95
  command: 'xdotool key super+s'
96
96
  pinch:
97
- in:
98
- command: 'xdotool key ctrl+plus'
99
- threshold: 0.1
100
- out:
101
- command: 'xdotool key ctrl+minus'
102
- threshold: 0.1
97
+ 2:
98
+ in:
99
+ command: 'xdotool key ctrl+plus'
100
+ threshold: 0.1
101
+ out:
102
+ command: 'xdotool key ctrl+minus'
103
+ threshold: 0.1
103
104
 
104
105
  threshold:
105
106
  swipe: 1
@@ -137,6 +138,11 @@ swipe:
137
138
  + command: 'xdotool key alt+Right'
138
139
  ```
139
140
 
141
+ ### About xdotool
142
+
143
+ * xdotool manual (https://github.com/jordansissel/xdotool/blob/master/xdotool.pod)
144
+ * Available keys' hint (https://github.com/jordansissel/xdotool/issues/212#issuecomment-406156157)
145
+
140
146
  ## Options
141
147
 
142
148
  * `-c`, `--config=path/to/file` : Use an alternative config file
@@ -146,10 +152,11 @@ swipe:
146
152
  * `--device="Device name"` : Open the given device only
147
153
  * `--version` : Show fusuma version
148
154
 
149
- ## Autostart(gnome-session-properties)
150
- 1. Check where you installed fusuma
155
+ ## Autostart (gnome-session-properties)
156
+ 1. Check the path where you installed fusuma with `$ which fusuma`
151
157
  2. Open `$ gnome-session-properties`
152
- 3. Add Fusuma and input location where you checked above's path
158
+ 3. Add Fusuma and enter the location where the above path was checked in the command input field
159
+ 4. Add the `-d` option at the end of the command input field
153
160
 
154
161
  ## Support
155
162
 
@@ -20,9 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1.13'
24
- spec.add_development_dependency 'pry'
25
- spec.add_development_dependency 'pry-byebug'
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'pry-byebug', '~> 3.4'
26
25
  spec.add_development_dependency 'rake', '~> 12.3'
27
26
  spec.add_development_dependency 'reek'
28
27
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -74,7 +74,7 @@ module Fusuma
74
74
 
75
75
  def run
76
76
  LibinputCommands.new.debug_events do |line|
77
- gesture_event = GestureEvent.initialize_by(line, Device.ids)
77
+ gesture_event = GestureEvent.initialize_by(line.to_s, Device.ids)
78
78
  next unless gesture_event
79
79
  @event_stack << gesture_event
80
80
  @event_stack.generate_command_executor.tap { |c| c.execute if c }
@@ -9,7 +9,11 @@ module Fusuma
9
9
  attr_reader :finger, :direction, :event_type
10
10
 
11
11
  def execute
12
- `#{command_or_shortcut}`
12
+ pid = fork {
13
+ Process.daemon(true)
14
+ exec("#{command_or_shortcut}")
15
+ }
16
+ Process.detach(pid)
13
17
  MultiLogger.info("Execute: #{command_or_shortcut}")
14
18
  end
15
19
 
@@ -11,6 +11,20 @@ module Fusuma
11
11
  @available = available
12
12
  end
13
13
 
14
+ # @param [Hash]
15
+ def assign_attributes(attributes)
16
+ attributes.each do |k, v|
17
+ case k
18
+ when :id
19
+ self.id = v
20
+ when :name
21
+ self.name = v
22
+ when :available
23
+ self.available = v
24
+ end
25
+ end
26
+ end
27
+
14
28
  class << self
15
29
  # @return [Array]
16
30
  def ids
@@ -38,7 +52,7 @@ module Fusuma
38
52
  @available = nil
39
53
  end
40
54
 
41
- # @params [String]
55
+ # @param [String]
42
56
  def given_device=(name)
43
57
  return if name.nil?
44
58
  @available = available.select { |d| d.name == name }
@@ -72,11 +86,12 @@ module Fusuma
72
86
  lines.push(line)
73
87
  end
74
88
 
89
+ # @return [Array]
75
90
  def generate_devices
76
91
  device = nil
77
92
  lines.each_with_object([]) do |line, devices|
78
93
  device ||= Device.new
79
- device = parse(device: device, line: line)
94
+ device.assign_attributes extract_attribute(line: line)
80
95
  if device.available
81
96
  devices << device
82
97
  device = nil
@@ -84,16 +99,18 @@ module Fusuma
84
99
  end
85
100
  end
86
101
 
87
- # @return [Device]
88
- def parse(device:, line:)
102
+ # @param [String]
103
+ # @return [Hash]
104
+ def extract_attribute(line:)
89
105
  if (id = id_from(line))
90
- device.id = id
106
+ { id: id }
91
107
  elsif (name = name_from(line))
92
- device.name = name
93
- elsif (available = natural_scroll_is_available?(line))
94
- device.available = available
108
+ { name: name }
109
+ elsif (available = available?(line))
110
+ { available: available }
111
+ else
112
+ {}
95
113
  end
96
- device
97
114
  end
98
115
 
99
116
  def id_from(line)
@@ -108,7 +125,8 @@ module Fusuma
108
125
  end
109
126
  end
110
127
 
111
- def natural_scroll_is_available?(line)
128
+ def available?(line)
129
+ # NOTE: natural scroll is available?
112
130
  return false unless line =~ /^Nat.scrolling: /
113
131
  return false if line =~ %r{n/a}
114
132
  true
@@ -15,14 +15,14 @@ module Fusuma
15
15
  class << self
16
16
  def initialize_by(line, device_names)
17
17
  return if device_names.none? do |device_name|
18
- line.to_s =~ /^\s?#{device_name}/
18
+ line =~ /^\s?#{device_name}/
19
19
  end
20
- return if line.to_s =~ /_BEGIN/
21
- return unless line.to_s =~ /GESTURE_SWIPE|GESTURE_PINCH/
20
+ return if line =~ /_BEGIN/
21
+ return unless line =~ /GESTURE_SWIPE|GESTURE_PINCH/
22
22
  time, event, finger, directions = gesture_event_arguments(line)
23
23
  MultiLogger.debug(time: time, event: event,
24
24
  finger: finger, directions: directions)
25
- GestureEvent.new(time, event, finger, directions)
25
+ new(time, event, finger, directions)
26
26
  end
27
27
 
28
28
  private
@@ -41,7 +41,7 @@ module Fusuma
41
41
  end
42
42
 
43
43
  def parse_finger_directions(line)
44
- return [] if line.nil?
44
+ return [] unless line
45
45
  move_x, move_y, _, _, _, zoom = line.tr('/|(|)', ' ').split
46
46
  [move_x, move_y, zoom]
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module Fusuma
2
- VERSION = '0.10.2'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,31 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.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: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.13'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.13'
27
- - !ruby/object:Gem::Dependency
28
- name: pry
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
@@ -42,16 +28,16 @@ dependencies:
42
28
  name: pry-byebug
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ">="
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '0'
33
+ version: '3.4'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ">="
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '0'
40
+ version: '3.4'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -125,6 +111,7 @@ files:
125
111
  - ".reek.yml"
126
112
  - ".rspec"
127
113
  - ".rubocop.yml"
114
+ - ".rubocop_todo.yml"
128
115
  - ".travis.yml"
129
116
  - CODE_OF_CONDUCT.md
130
117
  - Gemfile
@@ -166,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
153
  - !ruby/object:Gem::Version
167
154
  version: '0'
168
155
  requirements: []
169
- rubyforge_project:
170
- rubygems_version: 2.6.11
156
+ rubygems_version: 3.0.3
171
157
  signing_key:
172
158
  specification_version: 4
173
159
  summary: Multitouch gestures with libinput dirver on X11, Linux