fusuma-plugin-appmatcher 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -24
- data/fusuma-plugin-appmatcher.gemspec +4 -6
- data/lib/fusuma/plugin/appmatcher/gnome.rb +0 -1
- data/lib/fusuma/plugin/appmatcher/version.rb +1 -1
- data/lib/fusuma/plugin/appmatcher/x11.rb +4 -3
- data/spec/fusuma/plugin/appmatcher/gnome_spec.rb +16 -0
- data/spec/fusuma/plugin/appmatcher_spec.rb +9 -0
- data/spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb +68 -0
- data/spec/spec_helper.rb +16 -0
- metadata +18 -16
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -18
- data/Rakefile +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21759f031dfaf515588202ffbdf59be323542f1abe12ae08f037dceff4b5901f
|
4
|
+
data.tar.gz: f9e6365191943007c3550a4d7cc79496f529da49d7a9453ab4a672c7f35a4237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ce0492eeb84aa37a82fedab27befd850a17d8dde5d10ee8cc87bfbebf61c8fc53a484b2375e8f258cfa58fc716bdfd36a1f9d1c9db89333b8e118610e4320d
|
7
|
+
data.tar.gz: ef0643fa7604c9a11a20314e28a84a37695659ea76f10cd1fefec6fd24c1bd520611fce9712056632f38e67ab4f3cf0f70ec81eb754301492a7af0733af0ac09
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Fusuma::Plugin::Appmatcher [![Gem Version](https://badge.fury.io/rb/fusuma-plugin-appmatcher.svg)](https://badge.fury.io/rb/fusuma-plugin-appmatcher) [![Build Status](https://travis-ci.com/iberianpig/fusuma-plugin-appmatcher.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma-plugin-appmatcher)
|
2
2
|
|
3
|
-
[Fusuma](https://github.com/iberianpig/fusuma) plugin configure
|
3
|
+
[Fusuma](https://github.com/iberianpig/fusuma) plugin configure app-specific gestures
|
4
4
|
|
5
5
|
* Switch gesture mappings by detecting active application.
|
6
6
|
* Support X11, Ubuntu-Wayland
|
@@ -49,7 +49,7 @@ In the following example of config.yml
|
|
49
49
|
* On Google-chrome, the three-finger gesture is mapped to open in tab, close tab, back in history, forward in history.
|
50
50
|
* On Gnome-terminal, the three-finger gesture will be mapped to open in tab, close in tab.
|
51
51
|
|
52
|
-
```
|
52
|
+
```yaml
|
53
53
|
# this is default context
|
54
54
|
swipe:
|
55
55
|
4:
|
@@ -62,28 +62,28 @@ swipe:
|
|
62
62
|
sendkey: 'LEFTCTRL+LEFTALT+UP'
|
63
63
|
LEFTSHIFT:
|
64
64
|
sendkey: 'LEFTSHIFT+LEFTCTRL+LEFTALT+UP'
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
65
|
+
---
|
66
|
+
context:
|
67
|
+
application: Google-chrome
|
68
|
+
swipe:
|
69
|
+
3:
|
70
|
+
left:
|
71
|
+
sendkey: 'LEFTALT+RIGHT'
|
72
|
+
right:
|
73
|
+
sendkey: 'LEFTALT+LEFT'
|
74
|
+
up:
|
75
|
+
sendkey: 'LEFTCTRL+T'
|
76
|
+
down:
|
77
|
+
sendkey: 'LEFTCTRL+W'
|
78
|
+
---
|
79
|
+
context:
|
80
|
+
application: Gnome-terminal
|
81
|
+
swipe:
|
82
|
+
3:
|
83
|
+
up:
|
84
|
+
sendkey: 'LEFTSHIFT+LEFTCTRL+T'
|
85
|
+
down:
|
86
|
+
sendkey: 'LEFTSHIFT+LEFTCTRL+W'
|
87
87
|
```
|
88
88
|
|
89
89
|
## Contributing
|
@@ -16,16 +16,14 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
|
-
|
20
|
-
spec.
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
-
end
|
19
|
+
spec.files = Dir['{bin,lib,exe}/**/*', 'LICENSE*', 'README*', '*.gemspec']
|
20
|
+
spec.test_files = Dir['{test,spec,features}/**/*']
|
23
21
|
spec.bindir = 'exe'
|
24
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
23
|
spec.require_paths = ['lib']
|
26
24
|
|
27
|
-
spec.
|
25
|
+
spec.add_dependency "rexml" # ruby-dbus doesn't resolve dependency
|
28
26
|
spec.add_runtime_dependency 'ruby-dbus'
|
29
27
|
|
30
|
-
spec.add_dependency 'fusuma', '~> 2.0
|
28
|
+
spec.add_dependency 'fusuma', '~> 2.0'
|
31
29
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'open3'
|
3
4
|
require_relative './user_switcher'
|
4
5
|
require 'fusuma/multi_logger'
|
5
6
|
require 'fusuma/custom_process'
|
6
|
-
require 'posix/spawn'
|
7
7
|
|
8
8
|
module Fusuma
|
9
9
|
module Plugin
|
@@ -75,7 +75,7 @@ module Fusuma
|
|
75
75
|
private
|
76
76
|
|
77
77
|
def active_window_id(watch: false, &block)
|
78
|
-
|
78
|
+
i, o, e, _w = Open3.popen3(xprop_active_window_id(watch))
|
79
79
|
i.close
|
80
80
|
o.each do |line|
|
81
81
|
id = line.match(/0x[\da-z]{2,}/)&.to_s
|
@@ -89,7 +89,8 @@ module Fusuma
|
|
89
89
|
o.close
|
90
90
|
|
91
91
|
return nil unless block_given?
|
92
|
-
|
92
|
+
|
93
|
+
sleep 0.5
|
93
94
|
active_window_id(watch: watch, &block)
|
94
95
|
rescue StandardError => e
|
95
96
|
MultiLogger.error e.message
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require './lib/fusuma/plugin/appmatcher/gnome'
|
5
|
+
|
6
|
+
module Fusuma
|
7
|
+
module Plugin
|
8
|
+
module Appmatcher
|
9
|
+
RSpec.describe Gnome do
|
10
|
+
it 'requires ruby-dbus' do
|
11
|
+
expect(DBus).not_to be nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
require 'fusuma/plugin/detectors/detector'
|
6
|
+
require 'fusuma/plugin/buffers/buffer'
|
7
|
+
|
8
|
+
require './lib/fusuma/plugin/buffers/appmatcher_buffer'
|
9
|
+
require './lib/fusuma/plugin/detectors/appmatcher_detector'
|
10
|
+
|
11
|
+
module Fusuma
|
12
|
+
module Plugin
|
13
|
+
module Detectors
|
14
|
+
RSpec.describe AppmatcherDetector do
|
15
|
+
before do
|
16
|
+
@detector = AppmatcherDetector.new
|
17
|
+
@buffer = Buffers::AppmatcherBuffer.new
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#detector' do
|
21
|
+
context 'with no appmatcher event in buffer' do
|
22
|
+
before do
|
23
|
+
@buffer.clear
|
24
|
+
end
|
25
|
+
|
26
|
+
it { expect(@detector.detect([@buffer])).to eq nil }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'with appmatcher events in buffer' do
|
31
|
+
before do
|
32
|
+
record = Events::Records::AppmatcherRecord.new(name: 'dummy')
|
33
|
+
event = Events::Event.new(tag: 'appmatcher_parser', record: record)
|
34
|
+
|
35
|
+
@buffer.buffer(event)
|
36
|
+
end
|
37
|
+
it { expect(@detector.detect([@buffer])).to be_a Events::Event }
|
38
|
+
it 'should detect ContextRecord' do
|
39
|
+
expect(@detector.detect([@buffer]).record).to be_a Events::Records::ContextRecord
|
40
|
+
end
|
41
|
+
it 'should detect context: { application: dummy }' do
|
42
|
+
record = @detector.detect([@buffer]).record
|
43
|
+
expect(record.name).to eq :application
|
44
|
+
expect(record.value).to eq 'dummy'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with two different appmatcher events in buffer' do
|
49
|
+
before do
|
50
|
+
record1 = Events::Records::AppmatcherRecord.new(name: 'dummy1')
|
51
|
+
record2 = Events::Records::AppmatcherRecord.new(name: 'dummy2')
|
52
|
+
event1 = Events::Event.new(tag: 'appmatcher_parser', record: record1)
|
53
|
+
event2 = Events::Event.new(tag: 'appmatcher_parser', record: record2)
|
54
|
+
|
55
|
+
@buffer.buffer(event1)
|
56
|
+
@buffer.buffer(event2)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should detect latest application' do
|
60
|
+
record = @detector.detect([@buffer]).record
|
61
|
+
expect(record.name).to eq :application
|
62
|
+
expect(record.value).to eq 'dummy2'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'fusuma/plugin/appmatcher'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
# Enable flags like --only-failures and --next-failure
|
8
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
9
|
+
|
10
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
11
|
+
config.disable_monkey_patching!
|
12
|
+
|
13
|
+
config.expect_with :rspec do |c|
|
14
|
+
c.syntax = :expect
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusuma-plugin-appmatcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rexml
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0
|
54
|
+
version: '2.0'
|
55
55
|
description: fusuma-plugin-appmatcher is Fusuma plugin for assigning gesture mapping
|
56
56
|
per application.
|
57
57
|
email:
|
@@ -61,14 +61,8 @@ executables:
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- ".gitignore"
|
65
|
-
- ".rspec"
|
66
|
-
- ".travis.yml"
|
67
|
-
- CODE_OF_CONDUCT.md
|
68
|
-
- Gemfile
|
69
64
|
- LICENSE.txt
|
70
65
|
- README.md
|
71
|
-
- Rakefile
|
72
66
|
- bin/console
|
73
67
|
- bin/setup
|
74
68
|
- exe/fusuma-appmatcher
|
@@ -83,11 +77,15 @@ files:
|
|
83
77
|
- lib/fusuma/plugin/events/records/appmatcher_record.rb
|
84
78
|
- lib/fusuma/plugin/inputs/appmatcher_input.rb
|
85
79
|
- lib/fusuma/plugin/parsers/appmatcher_parser.rb
|
80
|
+
- spec/fusuma/plugin/appmatcher/gnome_spec.rb
|
81
|
+
- spec/fusuma/plugin/appmatcher_spec.rb
|
82
|
+
- spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb
|
83
|
+
- spec/spec_helper.rb
|
86
84
|
homepage: https://github.com/iberianpig/fusuma-plugin-appmatcher
|
87
85
|
licenses:
|
88
86
|
- MIT
|
89
87
|
metadata: {}
|
90
|
-
post_install_message:
|
88
|
+
post_install_message:
|
91
89
|
rdoc_options: []
|
92
90
|
require_paths:
|
93
91
|
- lib
|
@@ -102,8 +100,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
100
|
- !ruby/object:Gem::Version
|
103
101
|
version: '0'
|
104
102
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
-
signing_key:
|
103
|
+
rubygems_version: 3.2.15
|
104
|
+
signing_key:
|
107
105
|
specification_version: 4
|
108
106
|
summary: Fusuma plugin to assign gesture mapping per application
|
109
|
-
test_files:
|
107
|
+
test_files:
|
108
|
+
- spec/fusuma/plugin/appmatcher/gnome_spec.rb
|
109
|
+
- spec/fusuma/plugin/appmatcher_spec.rb
|
110
|
+
- spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at yhkyky@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in fusuma-plugin-appmatcher.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
gem 'bundler', '~> 2.0'
|
9
|
-
gem 'github_changelog_generator', '~> 1.14'
|
10
|
-
gem 'lefthook'
|
11
|
-
gem 'pry-byebug', '~> 3.4'
|
12
|
-
gem 'pry-doc'
|
13
|
-
gem 'pry-inline'
|
14
|
-
gem 'rake', '~> 13.0'
|
15
|
-
gem 'reek'
|
16
|
-
gem 'rspec', '~> 3.0'
|
17
|
-
gem 'rubocop'
|
18
|
-
gem 'yard'
|
data/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
|
-
task default: :spec
|
9
|
-
|
10
|
-
require 'github_changelog_generator/task'
|
11
|
-
|
12
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
13
|
-
config.user = 'iberianpig'
|
14
|
-
config.project = 'fusuma-plugin-appmatcher'
|
15
|
-
end
|