fusuma-plugin-appmatcher 0.1.4 → 0.1.5

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: 21759f031dfaf515588202ffbdf59be323542f1abe12ae08f037dceff4b5901f
4
- data.tar.gz: f9e6365191943007c3550a4d7cc79496f529da49d7a9453ab4a672c7f35a4237
3
+ metadata.gz: 5e83ab4ed022583573d314044dd916c8e997d7c8ded16d6e5e92dd47977eb68f
4
+ data.tar.gz: b25d958c8220d36c21ff0dae24fbf8e083feef7ca4d5317401de5926480b64af
5
5
  SHA512:
6
- metadata.gz: e5ce0492eeb84aa37a82fedab27befd850a17d8dde5d10ee8cc87bfbebf61c8fc53a484b2375e8f258cfa58fc716bdfd36a1f9d1c9db89333b8e118610e4320d
7
- data.tar.gz: ef0643fa7604c9a11a20314e28a84a37695659ea76f10cd1fefec6fd24c1bd520611fce9712056632f38e67ab4f3cf0f70ec81eb754301492a7af0733af0ac09
6
+ metadata.gz: 47204d64d8ea6999328d00a6e4eb4d36823e91aaff66a8f6afcaef5bc09c6e5a471da0c09b2cbc72093c8246eaa7446e12bb84d89f986ca937e7aa8667f13720
7
+ data.tar.gz: d738fcde80baaa9cd61869caeb26667d04c8a1951956d0f2b0e274696e4c5b8bf57881a00ff2157e4275284fac1c53e4383b834ce931d3d6f1c3fd0a4a626276
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Appmatcher
6
- VERSION = '0.1.4'
6
+ VERSION = '0.1.5'
7
7
  end
8
8
  end
9
9
  end
@@ -13,11 +13,30 @@ 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
+ private
33
+
34
+ def xdg_session_type
35
+ ENV.fetch('XDG_SESSION_TYPE', '')
36
+ end
37
+
38
+ def xdg_current_desktop
39
+ ENV.fetch('XDG_CURRENT_DESKTOP', '')
21
40
  end
22
41
  end
23
42
  end
@@ -2,8 +2,38 @@
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma-plugin-appmatcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-03 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rexml