fusuma-plugin-wmctrl 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f71997270e34b8604038cf56d738cfdcf56d99c727042b595b35e39e72cd5a2
|
4
|
+
data.tar.gz: 6836062464b71982a80abf152a258807bebe9ee911da23175c1c3f899e40b9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a3958f82aba9d729f9c33ac3bbd03f400eeba382aebf69a32abf62a6d2ccdfdf1a1785fa6169f2f060d89537d4e0665a948c8676bb26c4c7d0e5b43dea506cc
|
7
|
+
data.tar.gz: cd8f468211d2380e9aae329e9d4c86abbc4bca1ab75cc95fe7cccbba6b28a04061ac5dd1a191f87d41025d7c3813b1f0d55d12ed84e1928c31a1875a9f2b7147
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Fusuma::Plugin::
|
1
|
+
# Fusuma::Plugin::Wmctrl [](https://badge.fury.io/rb/fusuma-plugin-wmctrl) [](https://github.com/iberianpig/fusuma-plugin-wmctrl/actions/workflows/main.yml)
|
2
2
|
|
3
3
|
|
4
4
|
Window Manager plugin for [Fusuma](https://github.com/iberianpig/fusuma)
|
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.required_ruby_version = ">= 2.
|
25
|
-
#
|
24
|
+
spec.required_ruby_version = ">= 2.7"
|
25
|
+
# https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all§ion=main
|
26
|
+
# support focal (20.04LTS) 2.7
|
26
27
|
spec.add_dependency "fusuma", ">= 3.1"
|
27
28
|
end
|
@@ -8,6 +8,9 @@ module Fusuma
|
|
8
8
|
module Executors
|
9
9
|
# Control Window or Workspaces by executing wctrl
|
10
10
|
class WmctrlExecutor < Executor
|
11
|
+
class InvalidOption < StandardError; end
|
12
|
+
class NotInstalledError < StandardError; end
|
13
|
+
|
11
14
|
# executor properties on config.yml
|
12
15
|
# @return [Array<Symbol>]
|
13
16
|
def execute_keys
|
@@ -54,17 +57,44 @@ module Fusuma
|
|
54
57
|
# @return [String]
|
55
58
|
# @return [NilClass]
|
56
59
|
def search_command(event)
|
60
|
+
must_install!("wmctrl")
|
61
|
+
|
57
62
|
search_workspace_command(event) || search_window_command(event)
|
58
|
-
rescue
|
63
|
+
rescue InvalidOption, NotInstalledError => e
|
59
64
|
MultiLogger.error(e.message)
|
60
65
|
exit 1
|
61
66
|
end
|
62
67
|
|
63
68
|
private
|
64
69
|
|
70
|
+
# @return [NilClass] when wmctrl is installed
|
71
|
+
# @raise [NotInstalledError] when wmctrl is not installed
|
72
|
+
def must_install!(cmd)
|
73
|
+
return if @_installed
|
74
|
+
|
75
|
+
if which(cmd)
|
76
|
+
@_installed = true
|
77
|
+
else
|
78
|
+
raise NotInstalledError, "`#{cmd}` is not executable. Please install `#{cmd}`"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# which('ruby') #=> /usr/bin/ruby
|
83
|
+
def which(cmd)
|
84
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
85
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
86
|
+
exts.each do |ext|
|
87
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
88
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
|
65
94
|
# @param event [Event]
|
66
95
|
# @return [String]
|
67
96
|
# @return [NilClass]
|
97
|
+
# @raise [InvalidOption]
|
68
98
|
def search_workspace_command(event)
|
69
99
|
index = Config::Index.new([*event.record.index.keys, :workspace])
|
70
100
|
|
@@ -76,13 +106,16 @@ module Fusuma
|
|
76
106
|
when nil
|
77
107
|
nil
|
78
108
|
else
|
79
|
-
raise "#{property} is invalid key"
|
109
|
+
raise InvalidOption, "#{property} is invalid key"
|
80
110
|
end
|
111
|
+
rescue Workspace::MissingMatrixOption => e
|
112
|
+
raise InvalidOption, e.message
|
81
113
|
end
|
82
114
|
|
83
115
|
# @param event [Event]
|
84
116
|
# @return [String]
|
85
117
|
# @return [NilClass]
|
118
|
+
# @raise [InvalidOption]
|
86
119
|
def search_window_command(event)
|
87
120
|
index = Config::Index.new([*event.record.index.keys, :window])
|
88
121
|
|
@@ -106,8 +139,10 @@ module Fusuma
|
|
106
139
|
when nil
|
107
140
|
nil
|
108
141
|
else
|
109
|
-
raise "#{property} is invalid key"
|
142
|
+
raise InvalidOption, "#{property} is invalid key"
|
110
143
|
end
|
144
|
+
rescue Workspace::MissingMatrixOption => e
|
145
|
+
raise InvalidOption, e.message
|
111
146
|
end
|
112
147
|
end
|
113
148
|
end
|
@@ -31,6 +31,7 @@ module Fusuma
|
|
31
31
|
next_workspace_num
|
32
32
|
end
|
33
33
|
|
34
|
+
# @raise [MissingMatrixOption]
|
34
35
|
# @return [Array<Integer>]
|
35
36
|
def matrix_size(total_workspace_num)
|
36
37
|
must_have_matrix_option!
|
@@ -39,6 +40,7 @@ module Fusuma
|
|
39
40
|
[row_size.to_i, col_size.to_i]
|
40
41
|
end
|
41
42
|
|
43
|
+
# @raise [MissingMatrixOption]
|
42
44
|
def must_have_matrix_option!
|
43
45
|
return if @matrix_col_size
|
44
46
|
|
@@ -57,7 +59,8 @@ module Fusuma
|
|
57
59
|
end
|
58
60
|
|
59
61
|
# @return [Integer]
|
60
|
-
# @raise RuntimeError
|
62
|
+
# @raise [RuntimeError]
|
63
|
+
# @raise [MissingMatrixOption]
|
61
64
|
def next_workspace_num_for_matrix(direction:)
|
62
65
|
must_have_matrix_option!
|
63
66
|
current_workspace_num, total_workspace_num = workspace_values
|
@@ -131,6 +134,7 @@ module Fusuma
|
|
131
134
|
"wmctrl -r :ACTIVE: -t #{workspace_num} ; wmctrl -s #{workspace_num}"
|
132
135
|
end
|
133
136
|
|
137
|
+
# @raise [MissingMatrixOption]
|
134
138
|
def move_window_command_for_matrix(direction:)
|
135
139
|
workspace_num = next_workspace_num_for_matrix(direction: direction)
|
136
140
|
"wmctrl -r :ACTIVE: -t #{workspace_num} ; wmctrl -s #{workspace_num}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusuma-plugin-wmctrl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.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: 2024-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fusuma
|
@@ -56,14 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 2.
|
59
|
+
version: '2.7'
|
60
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.3.
|
66
|
+
rubygems_version: 3.3.27
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Wmctrl plugin for Fusuma
|