fusuma-plugin-appmatcher 0.1.2 → 0.1.6

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
2
  SHA256:
3
- metadata.gz: d3fa8f1ed20945e4d49be89c46c3929fa1d15917f220ba7b21d6c91b1b20c879
4
- data.tar.gz: 299aeeea9b8c25fb9434283f6543e918603172647d9f1e650050ea633da942e8
3
+ metadata.gz: 6bc3fbffcc3befbf8fc3d63baa992e737d0fa52233bbf47c0cb0645f4ab3f720
4
+ data.tar.gz: c6b3fcac639693631347643f479b950202a9e001fdc1bf0ed6d9fc2591b0ebde
5
5
  SHA512:
6
- metadata.gz: a110f9d5a00243c414da59079f49224c242cb68f686ac3f38798b0c9af3efe10c232a7fada48bce31b391434a58f484e5f4128af46f573de5f244328d433a9eb
7
- data.tar.gz: ab561b7c1e9c506259c1be0920811c894e897d8fd0d9c380a58409b640a96d32c2b2fdaf5781b004059a26654bcfe2b262682a7782b8363ca041add78488d172
6
+ metadata.gz: ee31ba4d167fc3f13bf64cbac3063776e6eb34b64b8f60524b5580470db313f1fc48ec165c278554401ccc633a59c15e60b4634ccf7534bb2260fb2af71811e8
7
+ data.tar.gz: df1e4f4624a4c71da254adc2a25a91e04be6b7fe7569eaa64763cd4202d18d80c007e35078088b7d959809fdc21e40bcfa6b817330e0e9e6cb35e23d2b44811f
data/README.md CHANGED
@@ -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
- ```diff
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
- + 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'
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
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
+ spec.add_dependency "rexml" # ruby-dbus doesn't resolve dependency
25
26
  spec.add_runtime_dependency 'ruby-dbus'
26
27
 
27
- spec.add_dependency 'fusuma', '~> 2.0.0'
28
+ spec.add_dependency 'fusuma', '~> 2.0'
28
29
  end
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Appmatcher
6
- VERSION = '0.1.2'
6
+ VERSION = '0.1.6'
7
7
  end
8
8
  end
9
9
  end
@@ -13,11 +13,28 @@ module Fusuma
13
13
 
14
14
  # @return [Class]
15
15
  def backend_klass
16
- if ENV['DESKTOP_SESSION'] == 'ubuntu-wayland'
17
- Gnome
18
- else
19
- X11
16
+ case xdg_session_type
17
+ when /x11/
18
+ return X11
19
+ when /wayland/
20
+ return Gnome if xdg_current_desktop =~ /GNOME/
20
21
  end
22
+ MultiLogger.error(
23
+ <<~ERROR
24
+ appmatcher doesn't support
25
+ XDG_CURRENT_DESKTOP: '#{xdg_current_desktop}'
26
+ XDG_SESSION_TYPE: '#{xdg_session_type}'"
27
+ ERROR
28
+ )
29
+ exit 1
30
+ end
31
+
32
+ def xdg_session_type
33
+ ENV.fetch('XDG_SESSION_TYPE', '')
34
+ end
35
+
36
+ def xdg_current_desktop
37
+ ENV.fetch('XDG_CURRENT_DESKTOP', '')
21
38
  end
22
39
  end
23
40
  end
@@ -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
@@ -1,9 +1,39 @@
1
1
  # frozen_string_literal: true
2
- #
2
+
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe Fusuma::Plugin::Appmatcher do
6
- it 'has a version number' do
7
- expect(Fusuma::Plugin::Appmatcher::VERSION).not_to be nil
5
+ module Fusuma
6
+ module Plugin
7
+ RSpec.describe Appmatcher do
8
+ it 'has a version number' do
9
+ expect(Appmatcher::VERSION).not_to be nil
10
+ end
11
+
12
+ describe '#backend_klass' do
13
+ context 'when XDG_CURRENT_DESKTOP is UNKNOWN' do
14
+ before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('UNKNOWN') }
15
+ it { expect { Appmatcher.backend_klass }.to raise_error }
16
+ end
17
+
18
+ context 'when XDG_SESSION_TYPE is x11' do
19
+ before { allow(Appmatcher).to receive(:xdg_session_type).and_return('x11') }
20
+ it { expect(Appmatcher.backend_klass).to eq Appmatcher::X11 }
21
+ end
22
+
23
+ context 'when XDG_SESSION_TYPE is wayland' do
24
+ before { allow(Appmatcher).to receive(:xdg_session_type).and_return('wayland') }
25
+
26
+ context 'when XDG_CURRENT_DESKTOP is ubuntu:GNOME' do
27
+ before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('ubuntu:GNOME') }
28
+ it { expect(Appmatcher.backend_klass).to eq Appmatcher::Gnome }
29
+ end
30
+
31
+ context 'when XDG_CURRENT_DESKTOP is UNKNOWN' do
32
+ before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('UNKNOWN') }
33
+ it { expect { Appmatcher.backend_klass }.to raise_error }
34
+ end
35
+ end
36
+ end
37
+ end
8
38
  end
9
39
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma-plugin-appmatcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
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-04-20 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rexml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: ruby-dbus
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,14 +44,14 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 2.0.0
47
+ version: '2.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 2.0.0
54
+ version: '2.0'
41
55
  description: fusuma-plugin-appmatcher is Fusuma plugin for assigning gesture mapping
42
56
  per application.
43
57
  email:
@@ -63,6 +77,7 @@ files:
63
77
  - lib/fusuma/plugin/events/records/appmatcher_record.rb
64
78
  - lib/fusuma/plugin/inputs/appmatcher_input.rb
65
79
  - lib/fusuma/plugin/parsers/appmatcher_parser.rb
80
+ - spec/fusuma/plugin/appmatcher/gnome_spec.rb
66
81
  - spec/fusuma/plugin/appmatcher_spec.rb
67
82
  - spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb
68
83
  - spec/spec_helper.rb
@@ -70,7 +85,7 @@ homepage: https://github.com/iberianpig/fusuma-plugin-appmatcher
70
85
  licenses:
71
86
  - MIT
72
87
  metadata: {}
73
- post_install_message:
88
+ post_install_message:
74
89
  rdoc_options: []
75
90
  require_paths:
76
91
  - lib
@@ -85,11 +100,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
100
  - !ruby/object:Gem::Version
86
101
  version: '0'
87
102
  requirements: []
88
- rubygems_version: 3.1.4
89
- signing_key:
103
+ rubygems_version: 3.2.15
104
+ signing_key:
90
105
  specification_version: 4
91
106
  summary: Fusuma plugin to assign gesture mapping per application
92
107
  test_files:
93
- - spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb
108
+ - spec/fusuma/plugin/appmatcher/gnome_spec.rb
94
109
  - spec/fusuma/plugin/appmatcher_spec.rb
110
+ - spec/fusuma/plugin/inputs/appmatcher_detector_spec.rb
95
111
  - spec/spec_helper.rb