fusuma-plugin-appmatcher 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/exe/fusuma-appmatcher +14 -12
- data/fusuma-plugin-appmatcher.gemspec +16 -15
- data/lib/fusuma/plugin/appmatcher/gnome.rb +6 -5
- data/lib/fusuma/plugin/appmatcher/gnome_extension.rb +5 -4
- data/lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb +5 -3
- data/lib/fusuma/plugin/appmatcher/unsupported_backend.rb +65 -0
- data/lib/fusuma/plugin/appmatcher/user_switcher.rb +13 -12
- data/lib/fusuma/plugin/appmatcher/version.rb +1 -1
- data/lib/fusuma/plugin/appmatcher/x11.rb +14 -13
- data/lib/fusuma/plugin/appmatcher.rb +6 -16
- data/lib/fusuma/plugin/buffers/appmatcher_buffer.rb +1 -1
- data/lib/fusuma/plugin/inputs/appmatcher_input.rb +16 -0
- data/spec/fusuma/plugin/appmatcher_spec.rb +1 -1
- data/spec/fusuma/plugin/detectors/appmatcher_detector_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- metadata +10 -10
- data/lib/fusuma/plugin/parsers/appmatcher_parser.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe1234e9a80678a14e7511bd16f449331e01db5feff4c0817f60471021c89771
|
4
|
+
data.tar.gz: 1dcde6b098cc837ffb39181d8019e6caa6ad6373d4e68dfc08299d6f9bea1a3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2830428a3681121a3bfd2e26ead8dd9a96e44a85faea4f08b949f872f4d60804352f8b60825c3950a233f9c31e03a6b6801ad27e1d69348ed284f65bb013ad84
|
7
|
+
data.tar.gz: 1ab8b7590a898b43bf0499a31095e9f22693654fee3aa13c98aa97d48ec3118158ba307d5aa84aae3c64c0f45869ff04216d2f35e3393c86179d2ed736dafac8
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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://github.com/iberianpig/fusuma/actions/workflows/
|
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://github.com/iberianpig/fusuma/actions/workflows/main.yml/badge.svg)](https://github.com/iberianpig/fusuma-plugin-appmatcher/actions/workflows/main.yml)
|
2
2
|
|
3
3
|
[Fusuma](https://github.com/iberianpig/fusuma) plugin configure app-specific gestures
|
4
4
|
|
data/exe/fusuma-appmatcher
CHANGED
@@ -1,46 +1,45 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require_relative
|
4
|
+
require "optparse"
|
5
|
+
require_relative "../lib/fusuma/plugin/appmatcher"
|
6
6
|
|
7
7
|
option = {}
|
8
8
|
opt = OptionParser.new
|
9
9
|
|
10
|
-
opt.on(
|
11
|
-
|
10
|
+
opt.on("-l", "--list-applications",
|
11
|
+
"List applications") do |v|
|
12
12
|
option[:list] = v
|
13
13
|
end
|
14
14
|
|
15
|
-
opt.on(
|
15
|
+
opt.on("--version", "Show version") do |v|
|
16
16
|
option[:version] = v
|
17
17
|
end
|
18
18
|
|
19
|
-
opt.on(
|
20
|
-
|
19
|
+
opt.on("--install-gnome-extension",
|
20
|
+
"Install GNOME extension for appmatcher") do |v|
|
21
21
|
option[:install_gnome_extension] = v
|
22
22
|
end
|
23
23
|
|
24
|
-
opt.on(
|
25
|
-
|
24
|
+
opt.on("--uninstall-gnome-extension",
|
25
|
+
"Uninstall GNOME extension for appmatcher") do |v|
|
26
26
|
option[:uninstall_gnome_extension] = v
|
27
27
|
end
|
28
28
|
|
29
29
|
opt.parse!(ARGV)
|
30
30
|
|
31
31
|
if option[:install_gnome_extension]
|
32
|
-
require_relative
|
32
|
+
require_relative "../lib/fusuma/plugin/appmatcher/gnome_extensions/installer"
|
33
33
|
Fusuma::Plugin::Appmatcher::GnomeExtensions::Installer.new.install
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
37
37
|
if option[:uninstall_gnome_extension]
|
38
|
-
require_relative
|
38
|
+
require_relative "../lib/fusuma/plugin/appmatcher/gnome_extensions/installer"
|
39
39
|
Fusuma::Plugin::Appmatcher::GnomeExtensions::Installer.new.uninstall
|
40
40
|
return
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
43
|
if option[:list]
|
45
44
|
matcher = Fusuma::Plugin::Appmatcher.backend_klass::Matcher.new
|
46
45
|
puts matcher.running_applications
|
@@ -49,6 +48,9 @@ end
|
|
49
48
|
|
50
49
|
if option[:version]
|
51
50
|
puts Fusuma::Plugin::Appmatcher::VERSION
|
51
|
+
puts "XDG_CURRENT_DESKTOP: #{ENV.fetch("XDG_CURRENT_DESKTOP", nil)}"
|
52
|
+
puts "XDG_SESSION_TYPE: #{ENV.fetch("XDG_SESSION_TYPE", nil)}"
|
53
|
+
puts "Backend: #{Fusuma::Plugin::Appmatcher.backend_klass}"
|
52
54
|
return
|
53
55
|
end
|
54
56
|
|
@@ -5,29 +5,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require "fusuma/plugin/appmatcher/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
8
|
+
spec.name = "fusuma-plugin-appmatcher"
|
9
|
+
spec.version = Fusuma::Plugin::Appmatcher::VERSION
|
10
|
+
spec.authors = ["iberianpig"]
|
11
|
+
spec.email = ["yhkyky@gmail.com"]
|
12
12
|
|
13
|
-
spec.summary
|
14
|
-
spec.description
|
15
|
-
spec.homepage
|
16
|
-
spec.license
|
13
|
+
spec.summary = "Fusuma plugin to assign gesture mapping per application"
|
14
|
+
spec.description = "fusuma-plugin-appmatcher is Fusuma plugin for assigning gesture mapping per application."
|
15
|
+
spec.homepage = "https://github.com/iberianpig/fusuma-plugin-appmatcher"
|
16
|
+
spec.license = "MIT"
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
|
-
spec.files
|
20
|
-
spec.test_files
|
21
|
-
spec.bindir
|
22
|
-
spec.executables
|
19
|
+
spec.files = Dir["{bin,lib,exe}/**/*", "LICENSE*", "README*", "*.gemspec"]
|
20
|
+
spec.test_files = Dir["{test,spec,features}/**/*"]
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_dependency "rexml" # ruby-dbus doesn't resolve dependency
|
26
26
|
spec.add_runtime_dependency "ruby-dbus"
|
27
27
|
|
28
|
-
spec.add_dependency "fusuma", "
|
28
|
+
spec.add_dependency "fusuma", ">= 3.0"
|
29
29
|
spec.metadata["rubygems_mfa_required"] = "true"
|
30
30
|
|
31
|
-
spec.required_ruby_version = ">= 2.
|
32
|
-
#
|
31
|
+
spec.required_ruby_version = ">= 2.7"
|
32
|
+
# https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all§ion=main
|
33
|
+
# support focal (20.04LTS) 2.7
|
33
34
|
end
|
@@ -9,7 +9,9 @@ module Fusuma
|
|
9
9
|
module Appmatcher
|
10
10
|
# Search Active Window's Name
|
11
11
|
class Gnome
|
12
|
-
|
12
|
+
include UserSwitcher
|
13
|
+
|
14
|
+
attr_reader :reader, :writer
|
13
15
|
|
14
16
|
def initialize
|
15
17
|
@reader, @writer = IO.pipe
|
@@ -19,12 +21,11 @@ module Fusuma
|
|
19
21
|
# @return [Integer] Process id
|
20
22
|
def watch_start
|
21
23
|
@watch_start ||= begin
|
22
|
-
pid =
|
24
|
+
pid = as_user(proctitle: self.class.name.underscore) do |user|
|
23
25
|
@reader.close
|
24
26
|
ENV["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/run/user/#{user.uid}/bus"
|
25
27
|
register_on_application_changed(Matcher.new)
|
26
28
|
end
|
27
|
-
Process.detach(pid)
|
28
29
|
pid
|
29
30
|
end
|
30
31
|
end
|
@@ -41,7 +42,7 @@ module Fusuma
|
|
41
42
|
@writer.puts(name)
|
42
43
|
rescue Errno::EPIPE
|
43
44
|
exit 0
|
44
|
-
rescue
|
45
|
+
rescue => e
|
45
46
|
MultiLogger.error e.message
|
46
47
|
exit 1
|
47
48
|
end
|
@@ -101,7 +102,7 @@ module Fusuma
|
|
101
102
|
if success
|
102
103
|
response = begin
|
103
104
|
JSON.parse(body)
|
104
|
-
rescue
|
105
|
+
rescue
|
105
106
|
nil
|
106
107
|
end
|
107
108
|
return response
|
@@ -9,7 +9,9 @@ module Fusuma
|
|
9
9
|
module Appmatcher
|
10
10
|
# Search Active Window's Name
|
11
11
|
class GnomeExtension
|
12
|
-
|
12
|
+
include UserSwitcher
|
13
|
+
|
14
|
+
attr_reader :reader, :writer
|
13
15
|
|
14
16
|
def initialize
|
15
17
|
@reader, @writer = IO.pipe
|
@@ -19,12 +21,11 @@ module Fusuma
|
|
19
21
|
# @return [Integer] Process id
|
20
22
|
def watch_start
|
21
23
|
@watch_start ||= begin
|
22
|
-
pid =
|
24
|
+
pid = as_user(proctitle: self.class.name.underscore) do |user|
|
23
25
|
@reader.close
|
24
26
|
ENV["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/run/user/#{user.uid}/bus"
|
25
27
|
register_on_application_changed(Matcher.new)
|
26
28
|
end
|
27
|
-
Process.detach(pid)
|
28
29
|
pid
|
29
30
|
end
|
30
31
|
end
|
@@ -47,7 +48,7 @@ module Fusuma
|
|
47
48
|
@writer.puts(name)
|
48
49
|
rescue Errno::EPIPE
|
49
50
|
exit 0
|
50
|
-
rescue
|
51
|
+
rescue => e
|
51
52
|
MultiLogger.error e.message
|
52
53
|
exit 1
|
53
54
|
end
|
@@ -9,10 +9,12 @@ module Fusuma
|
|
9
9
|
module GnomeExtensions
|
10
10
|
# Install Gnome Extension
|
11
11
|
class Installer
|
12
|
+
include UserSwitcher
|
13
|
+
|
12
14
|
EXTENSION = "./appmatcher@iberianpig.dev"
|
13
15
|
|
14
16
|
def install
|
15
|
-
pid =
|
17
|
+
pid = as_user(proctitle: self.class.name.underscore) do |user|
|
16
18
|
FileUtils.cp_r(source_path, user_extension_dir(user.username))
|
17
19
|
puts "Installed Appmatcher Gnome Shell Extension to #{user_extension_dir(user.username)}"
|
18
20
|
puts "Restart your session, then activate Appmatcher on gnome-extensions-app"
|
@@ -23,7 +25,7 @@ module Fusuma
|
|
23
25
|
def uninstall
|
24
26
|
return puts "Appmatcher Gnome Shell Extension is not installed in #{user_extension_dir}/" unless installed?
|
25
27
|
|
26
|
-
pid =
|
28
|
+
pid = as_user(proctitle: self.class.name.underscore) do |user|
|
27
29
|
FileUtils.rm_r(install_path(user.username))
|
28
30
|
puts "Uninstalled Appmatcher Gnome Shell Extension from #{install_path(user.username)}"
|
29
31
|
end
|
@@ -49,7 +51,7 @@ module Fusuma
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def login_username
|
52
|
-
UserSwitcher.
|
54
|
+
UserSwitcher.login_user.username
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "open3"
|
4
|
+
require_relative "./user_switcher"
|
5
|
+
require "fusuma/multi_logger"
|
6
|
+
require "fusuma/custom_process"
|
7
|
+
|
8
|
+
module Fusuma
|
9
|
+
module Plugin
|
10
|
+
module Appmatcher
|
11
|
+
# Dummy for unsupported Backend
|
12
|
+
class UnsupportedBackend
|
13
|
+
include UserSwitcher
|
14
|
+
|
15
|
+
attr_reader :reader, :writer
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
# need IO object for IO.select()
|
19
|
+
@reader, @writer = IO.pipe
|
20
|
+
end
|
21
|
+
|
22
|
+
# fork process and watch signal
|
23
|
+
# @return [Integer] Process id
|
24
|
+
def watch_start
|
25
|
+
@watch_start ||= begin
|
26
|
+
pid = as_user(proctitle: self.class.name.underscore) do
|
27
|
+
@reader.close
|
28
|
+
sleep # stop indefinitely without using CPU
|
29
|
+
end
|
30
|
+
pid
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Matcher
|
35
|
+
def initialize
|
36
|
+
end
|
37
|
+
|
38
|
+
def running_applications
|
39
|
+
warn
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def active_application
|
44
|
+
warn
|
45
|
+
nil
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def warn
|
51
|
+
MultiLogger.warn(
|
52
|
+
<<~MSG
|
53
|
+
appmatcher doesn't support
|
54
|
+
XDG_CURRENT_DESKTOP: '#{Appmatcher.xdg_current_desktop}'
|
55
|
+
XDG_SESSION_TYPE: '#{Appmatcher.xdg_session_type}'
|
56
|
+
|
57
|
+
using dummy backend instead
|
58
|
+
MSG
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -7,18 +7,8 @@ module Fusuma
|
|
7
7
|
module Plugin
|
8
8
|
module Appmatcher
|
9
9
|
# Drop sudo privileges
|
10
|
-
|
10
|
+
module UserSwitcher
|
11
11
|
include CustomProcess
|
12
|
-
User = Struct.new(:username, :uid, :gid)
|
13
|
-
|
14
|
-
attr_reader :login_user
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
username = ENV["SUDO_USER"] || Etc.getlogin
|
18
|
-
uid = `id -u #{username}`.chomp.to_i
|
19
|
-
gid = `id -g #{username}`.chomp.to_i
|
20
|
-
@login_user = User.new(username, uid, gid)
|
21
|
-
end
|
22
12
|
|
23
13
|
# Drops privileges to that of the specified user
|
24
14
|
def drop_priv(user)
|
@@ -30,7 +20,7 @@ module Fusuma
|
|
30
20
|
|
31
21
|
# Execute the provided block in a child process as the specified user
|
32
22
|
# The parent blocks until the child finishes.
|
33
|
-
def as_user(user =
|
23
|
+
def as_user(user = login_user, proctitle:)
|
34
24
|
self.proctitle = "#{self.class.name.underscore}(#{user.username}) -> #{proctitle}"
|
35
25
|
|
36
26
|
fork do
|
@@ -38,6 +28,17 @@ module Fusuma
|
|
38
28
|
yield(user) if block_given?
|
39
29
|
end
|
40
30
|
end
|
31
|
+
|
32
|
+
User = Struct.new(:username, :uid, :gid)
|
33
|
+
def login_user
|
34
|
+
@login_user ||= begin
|
35
|
+
username = ENV["SUDO_USER"] || Etc.getlogin
|
36
|
+
uid = `id -u #{username}`.chomp.to_i
|
37
|
+
gid = `id -g #{username}`.chomp.to_i
|
38
|
+
User.new(username, uid, gid)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
module_function :login_user
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -10,7 +10,9 @@ module Fusuma
|
|
10
10
|
module Appmatcher
|
11
11
|
# Search Active Window's Name
|
12
12
|
class X11
|
13
|
-
|
13
|
+
include UserSwitcher
|
14
|
+
|
15
|
+
attr_reader :reader, :writer
|
14
16
|
|
15
17
|
def initialize
|
16
18
|
@reader, @writer = IO.pipe
|
@@ -20,11 +22,10 @@ module Fusuma
|
|
20
22
|
# @return [Integer] Process id
|
21
23
|
def watch_start
|
22
24
|
@watch_start ||= begin
|
23
|
-
pid =
|
25
|
+
pid = as_user(proctitle: self.class.name.underscore) do |_user|
|
24
26
|
@reader.close
|
25
27
|
register_on_application_changed(Matcher.new)
|
26
28
|
end
|
27
|
-
Process.detach(pid)
|
28
29
|
pid
|
29
30
|
end
|
30
31
|
end
|
@@ -41,7 +42,7 @@ module Fusuma
|
|
41
42
|
@writer.puts(name)
|
42
43
|
rescue Errno::EPIPE
|
43
44
|
exit 0
|
44
|
-
rescue
|
45
|
+
rescue => e
|
45
46
|
MultiLogger.error e.message
|
46
47
|
exit 1
|
47
48
|
end
|
@@ -51,8 +52,8 @@ module Fusuma
|
|
51
52
|
# @return [Array<String>]
|
52
53
|
def running_applications
|
53
54
|
`xprop -root _NET_CLIENT_LIST_STACKING`.split(", ")
|
54
|
-
|
55
|
-
|
55
|
+
.map { |id_str| id_str.match(/0x[\da-z]{2,}/).to_s }
|
56
|
+
.map { |id| active_application(id) }
|
56
57
|
end
|
57
58
|
|
58
59
|
# @return [String]
|
@@ -60,10 +61,10 @@ module Fusuma
|
|
60
61
|
def active_application(id = active_window_id)
|
61
62
|
@cache ||= {}
|
62
63
|
@cache[id] ||= if id.nil?
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
nil
|
65
|
+
else
|
66
|
+
`xprop -id #{id} WM_CLASS | cut -d "=" -f 2 | tr -d '"'`.strip.split(", ").last
|
67
|
+
end
|
67
68
|
end
|
68
69
|
|
69
70
|
def on_active_application_changed
|
@@ -80,7 +81,7 @@ module Fusuma
|
|
80
81
|
o.each do |line|
|
81
82
|
id = line.match(/0x[\da-z]{2,}/)&.to_s
|
82
83
|
|
83
|
-
return id unless
|
84
|
+
return id unless block
|
84
85
|
|
85
86
|
yield(id)
|
86
87
|
end
|
@@ -88,11 +89,11 @@ module Fusuma
|
|
88
89
|
e.close
|
89
90
|
o.close
|
90
91
|
|
91
|
-
return nil unless
|
92
|
+
return nil unless block
|
92
93
|
|
93
94
|
sleep 0.5
|
94
95
|
active_window_id(watch: watch, &block)
|
95
|
-
rescue
|
96
|
+
rescue => e
|
96
97
|
MultiLogger.error e.message
|
97
98
|
end
|
98
99
|
|
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
require "fusuma/plugin/appmatcher/version"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
require "fusuma/plugin/appmatcher/x11"
|
6
|
+
require "fusuma/plugin/appmatcher/gnome"
|
7
|
+
require "fusuma/plugin/appmatcher/gnome_extension"
|
8
|
+
require "fusuma/plugin/appmatcher/gnome_extensions/installer"
|
9
|
+
require "fusuma/plugin/appmatcher/unsupported_backend"
|
9
10
|
|
10
11
|
module Fusuma
|
11
12
|
module Plugin
|
@@ -27,8 +28,7 @@ module Fusuma
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
-
exit 1
|
31
|
+
UnsupportedBackend
|
32
32
|
end
|
33
33
|
|
34
34
|
def xdg_session_type
|
@@ -38,16 +38,6 @@ module Fusuma
|
|
38
38
|
def xdg_current_desktop
|
39
39
|
ENV.fetch("XDG_CURRENT_DESKTOP", "")
|
40
40
|
end
|
41
|
-
|
42
|
-
def error_message_not_supported
|
43
|
-
MultiLogger.error(
|
44
|
-
<<~ERROR
|
45
|
-
appmatcher doesn't support
|
46
|
-
XDG_CURRENT_DESKTOP: '#{xdg_current_desktop}'
|
47
|
-
XDG_SESSION_TYPE: '#{xdg_session_type}'"
|
48
|
-
ERROR
|
49
|
-
)
|
50
|
-
end
|
51
41
|
end
|
52
42
|
end
|
53
43
|
end
|
@@ -22,6 +22,22 @@ module Fusuma
|
|
22
22
|
|
23
23
|
@backend.reader
|
24
24
|
end
|
25
|
+
|
26
|
+
def shutdown
|
27
|
+
# CustomProcess#shutdown
|
28
|
+
@backend.shutdown
|
29
|
+
end
|
30
|
+
|
31
|
+
# @param record [String] application name
|
32
|
+
# @return [Event]
|
33
|
+
def create_event(record:)
|
34
|
+
e = Events::Event.new(
|
35
|
+
tag: tag,
|
36
|
+
record: Events::Records::AppmatcherRecord.new(name: record)
|
37
|
+
)
|
38
|
+
MultiLogger.debug(input_event: e)
|
39
|
+
e
|
40
|
+
end
|
25
41
|
end
|
26
42
|
end
|
27
43
|
end
|
@@ -42,7 +42,7 @@ module Fusuma
|
|
42
42
|
allow(Appmatcher).to receive(:xdg_current_desktop).and_return("UNKNOWN")
|
43
43
|
allow(MultiLogger).to receive(:error)
|
44
44
|
end
|
45
|
-
it {
|
45
|
+
it { is_expected.to eq Appmatcher::UnsupportedBackend }
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -30,7 +30,7 @@ module Fusuma
|
|
30
30
|
context "with appmatcher events in buffer" do
|
31
31
|
before do
|
32
32
|
record = Events::Records::AppmatcherRecord.new(name: "dummy")
|
33
|
-
event = Events::Event.new(tag: "
|
33
|
+
event = Events::Event.new(tag: "appmatcher_input", record: record)
|
34
34
|
|
35
35
|
@buffer.buffer(event)
|
36
36
|
end
|
@@ -49,8 +49,8 @@ module Fusuma
|
|
49
49
|
before do
|
50
50
|
record1 = Events::Records::AppmatcherRecord.new(name: "dummy1")
|
51
51
|
record2 = Events::Records::AppmatcherRecord.new(name: "dummy2")
|
52
|
-
event1 = Events::Event.new(tag: "
|
53
|
-
event2 = Events::Event.new(tag: "
|
52
|
+
event1 = Events::Event.new(tag: "appmatcher_input", record: record1)
|
53
|
+
event2 = Events::Event.new(tag: "appmatcher_input", record: record2)
|
54
54
|
|
55
55
|
@buffer.buffer(event1)
|
56
56
|
@buffer.buffer(event2)
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: fusuma
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.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: '
|
54
|
+
version: '3.0'
|
55
55
|
description: fusuma-plugin-appmatcher is Fusuma plugin for assigning gesture mapping
|
56
56
|
per application.
|
57
57
|
email:
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/fusuma/plugin/appmatcher/gnome_extensions/appmatcher@iberianpig.dev/extension.js
|
74
74
|
- lib/fusuma/plugin/appmatcher/gnome_extensions/appmatcher@iberianpig.dev/metadata.json
|
75
75
|
- lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb
|
76
|
+
- lib/fusuma/plugin/appmatcher/unsupported_backend.rb
|
76
77
|
- lib/fusuma/plugin/appmatcher/user_switcher.rb
|
77
78
|
- lib/fusuma/plugin/appmatcher/version.rb
|
78
79
|
- lib/fusuma/plugin/appmatcher/x11.rb
|
@@ -80,7 +81,6 @@ files:
|
|
80
81
|
- lib/fusuma/plugin/detectors/appmatcher_detector.rb
|
81
82
|
- lib/fusuma/plugin/events/records/appmatcher_record.rb
|
82
83
|
- lib/fusuma/plugin/inputs/appmatcher_input.rb
|
83
|
-
- lib/fusuma/plugin/parsers/appmatcher_parser.rb
|
84
84
|
- spec/fusuma/plugin/appmatcher/gnome_extensions/installer_spec.rb
|
85
85
|
- spec/fusuma/plugin/appmatcher/gnome_spec.rb
|
86
86
|
- spec/fusuma/plugin/appmatcher_spec.rb
|
@@ -99,20 +99,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 2.
|
102
|
+
version: '2.7'
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.4.10
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Fusuma plugin to assign gesture mapping per application
|
113
113
|
test_files:
|
114
|
-
- spec/fusuma/plugin/appmatcher_spec.rb
|
115
114
|
- spec/fusuma/plugin/appmatcher/gnome_extensions/installer_spec.rb
|
116
115
|
- spec/fusuma/plugin/appmatcher/gnome_spec.rb
|
116
|
+
- spec/fusuma/plugin/appmatcher_spec.rb
|
117
117
|
- spec/fusuma/plugin/detectors/appmatcher_detector_spec.rb
|
118
118
|
- spec/spec_helper.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Fusuma
|
4
|
-
module Plugin
|
5
|
-
module Parsers
|
6
|
-
# Generate AppmatcherRecord from libinput_command_input
|
7
|
-
class AppmatcherParser < Parser
|
8
|
-
DEFAULT_SOURCE = "appmatcher_input"
|
9
|
-
|
10
|
-
# @param record [String]
|
11
|
-
# @return [Records::Gesture, nil]
|
12
|
-
def parse_record(record)
|
13
|
-
line = record.to_s
|
14
|
-
Events::Records::AppmatcherRecord.new(name: line)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|