fusuma-plugin-wmctrl 0.4.0.pre → 0.4.0.pre2
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 +4 -4
- data/CHANGELOG.md +2 -2
- data/README.md +28 -3
- data/fusuma-plugin-wmctrl.gemspec +1 -1
- data/lib/fusuma/plugin/executors/wmctrl_executor.rb +64 -8
- data/lib/fusuma/plugin/wmctrl/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '069aaa7f3d06e2445189455621c251823ae6b012b3aae0c7ec717f013af5c4c9'
|
4
|
+
data.tar.gz: cabf1c51189097888bcc4f729ffbc985b3a953cbb65a260a517b807f234056bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7e2d157ca4e01b97b09bebe5354069b03a43d3fa47234c39eb5bdfd8f92fa510139c48618d3e428ebbf8a0663dcaffe628b1f77c3c422abaa84203b91fd8a40
|
7
|
+
data.tar.gz: 216014d9644812c3992b7e8ba02f1816737eea4ce00f1097070c8b9acf15719ee874a4c635eaadc57711c4a5f1c427300031cc5ce5f91a60f484eda4534cd5f7
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v0.4.0.pre](https://github.com/iberianpig/fusuma-plugin-wmctrl/tree/v0.4.0.pre) (2020-11-09)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/iberianpig/fusuma-plugin-wmctrl/compare/v0.3.0...
|
5
|
+
[Full Changelog](https://github.com/iberianpig/fusuma-plugin-wmctrl/compare/v0.3.0...v0.4.0.pre)
|
6
6
|
|
7
7
|
**Merged pull requests:**
|
8
8
|
|
data/README.md
CHANGED
@@ -10,15 +10,29 @@ Window Manager plugin for [Fusuma](https://github.com/iberianpig/fusuma)
|
|
10
10
|
|
11
11
|
Run the following code in your terminal.
|
12
12
|
|
13
|
-
### Install wmctrl
|
13
|
+
### 1.Install wmctrl
|
14
|
+
|
15
|
+
#### For Debian Based Distros (Ubuntu, Debian, Mint, Pop!_OS)
|
14
16
|
|
15
17
|
```
|
16
|
-
$ sudo apt install wmctrl
|
18
|
+
$ sudo apt install wmctrl -y
|
17
19
|
```
|
18
|
-
|
20
|
+
|
21
|
+
#### For Arch Based Distros (Manjaro, Arch)
|
22
|
+
|
23
|
+
```
|
24
|
+
sudo pacman -S wmctrl
|
25
|
+
```
|
26
|
+
|
27
|
+
### 2. Install fusuma-plugin-wmctrl
|
19
28
|
|
20
29
|
This plugin requires [Fusuma](https://github.com/iberianpig/fusuma#update) version 1.0 or later.
|
21
30
|
|
31
|
+
|
32
|
+
**Note For Arch Based Distros:** By default in Arch Linux, when running ```gem```, gems are installed per-user (into ```~/.gem/ruby/```), instead of system-wide (into ```/usr/lib/ruby/gems/```). This is considered the best way to manage gems on Arch, because otherwise they might interfere with gems installed by Pacman. (From Arch Wiki)
|
33
|
+
|
34
|
+
To install gems system-wide, see any of the methods listed on [Arch Wiki](https://wiki.archlinux.org/index.php/ruby#Installing_gems_system-wide)
|
35
|
+
|
22
36
|
```sh
|
23
37
|
$ sudo gem install fusuma-plugin-wmctrl
|
24
38
|
```
|
@@ -95,6 +109,17 @@ swipe:
|
|
95
109
|
workspace: 'prev'
|
96
110
|
```
|
97
111
|
|
112
|
+
## Configuration
|
113
|
+
|
114
|
+
The plugin allows to enable (disabled by default) circular navigation between workspaces. To enable it set the following in your config file `~/.config/fusuma/config.yml`.
|
115
|
+
|
116
|
+
```yaml
|
117
|
+
plugin:
|
118
|
+
executors:
|
119
|
+
wmctrl_executor:
|
120
|
+
wrap-navigation: true
|
121
|
+
```
|
122
|
+
|
98
123
|
|
99
124
|
## Contributing
|
100
125
|
|
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
27
|
spec.required_ruby_version = '>= 2.3' # https://packages.ubuntu.com/search?keywords=ruby&searchon=names&exact=1&suite=all§ion=main
|
28
|
-
spec.add_dependency 'fusuma', '~> 2.0.0.
|
28
|
+
spec.add_dependency 'fusuma', '~> 2.0.0.pre2'
|
29
29
|
end
|
@@ -1,12 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'posix/spawn'
|
4
|
+
require 'singleton'
|
4
5
|
|
5
6
|
module Fusuma
|
6
7
|
module Plugin
|
7
8
|
module Executors
|
8
9
|
# Control Window or Workspaces by executing wctrl
|
9
10
|
class WmctrlExecutor < Executor
|
11
|
+
# executor properties on config.yml
|
12
|
+
# @return [Array<Symbol>]
|
13
|
+
def execute_keys
|
14
|
+
%i[wmctrl workspace]
|
15
|
+
end
|
16
|
+
|
17
|
+
def config_param_types
|
18
|
+
{
|
19
|
+
'wrap-navigation': [TrueClass, FalseClass]
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
Workspace.configure(wrap_navigation: config_params(:'wrap-navigation'))
|
25
|
+
end
|
26
|
+
|
10
27
|
# execute wmctrl command
|
11
28
|
# @param event [Event]
|
12
29
|
# @return [nil]
|
@@ -74,25 +91,64 @@ module Fusuma
|
|
74
91
|
|
75
92
|
# Manage workspace
|
76
93
|
class Workspace
|
94
|
+
include Singleton
|
95
|
+
|
96
|
+
attr_accessor :wrap_navigation
|
97
|
+
|
77
98
|
class << self
|
78
|
-
#
|
99
|
+
# configure properties of the workspace switcher
|
100
|
+
# @return [NilClass]
|
101
|
+
def configure(wrap_navigation:)
|
102
|
+
instance.wrap_navigation = wrap_navigation
|
103
|
+
end
|
104
|
+
|
105
|
+
# get next workspace number
|
79
106
|
# @return [Integer]
|
80
|
-
def
|
81
|
-
|
82
|
-
|
107
|
+
def next_workspace_num(step:)
|
108
|
+
current_workspace_num, total_workspace_num = workspace_values
|
109
|
+
|
110
|
+
next_workspace_num = current_workspace_num + step
|
111
|
+
|
112
|
+
return next_workspace_num unless instance.wrap_navigation
|
113
|
+
|
114
|
+
if next_workspace_num.negative?
|
115
|
+
next_workspace_num = total_workspace_num - 1
|
116
|
+
elsif next_workspace_num >= total_workspace_num
|
117
|
+
next_workspace_num = 0
|
118
|
+
else
|
119
|
+
next_workspace_num
|
120
|
+
end
|
83
121
|
end
|
84
122
|
|
85
123
|
def move_command(direction:)
|
86
124
|
workspace_num = case direction
|
87
125
|
when 'next'
|
88
|
-
|
126
|
+
next_workspace_num(step: 1)
|
89
127
|
when 'prev'
|
90
|
-
|
128
|
+
next_workspace_num(step: -1)
|
91
129
|
else
|
92
130
|
raise "#{direction} is invalid key"
|
93
131
|
end
|
94
132
|
"wmctrl -s #{workspace_num}"
|
95
133
|
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
# get current workspace and total workspace numbers
|
138
|
+
# @return [Integer, Integer]
|
139
|
+
def workspace_values
|
140
|
+
wmctrl_output = `wmctrl -d`.split("\n")
|
141
|
+
|
142
|
+
current_line = wmctrl_output.grep(/\*/).first
|
143
|
+
# NOTE: stderror when failed to get desktop
|
144
|
+
# `Cannot get current desktop properties. (_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)`
|
145
|
+
return [0, 1] if current_line.nil? # If not found ,return desktop id as 0 and the total number as 1
|
146
|
+
|
147
|
+
current_workspace_num = current_line.chars.first.to_i
|
148
|
+
total_workspace_num = wmctrl_output.length
|
149
|
+
|
150
|
+
[current_workspace_num, total_workspace_num]
|
151
|
+
end
|
96
152
|
end
|
97
153
|
end
|
98
154
|
|
@@ -116,9 +172,9 @@ module Fusuma
|
|
116
172
|
def move_command(direction:)
|
117
173
|
workspace_num = case direction
|
118
174
|
when 'next'
|
119
|
-
Workspace.
|
175
|
+
Workspace.next_workspace_num(step: 1)
|
120
176
|
when 'prev'
|
121
|
-
Workspace.
|
177
|
+
Workspace.next_workspace_num(step: -1)
|
122
178
|
else
|
123
179
|
raise "#{direction} is invalid key"
|
124
180
|
end
|
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: 0.4.0.
|
4
|
+
version: 0.4.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fusuma
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.0.
|
19
|
+
version: 2.0.0.pre2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.0.
|
26
|
+
version: 2.0.0.pre2
|
27
27
|
description: fusuma-plugin-wmctrl is Fusuma plugin for window manager.
|
28
28
|
email:
|
29
29
|
- yhkyky@gmail.com
|
@@ -52,7 +52,7 @@ homepage: https://github.com/iberianpig/fusuma-plugin-wmctrl
|
|
52
52
|
licenses:
|
53
53
|
- MIT
|
54
54
|
metadata: {}
|
55
|
-
post_install_message:
|
55
|
+
post_install_message:
|
56
56
|
rdoc_options: []
|
57
57
|
require_paths:
|
58
58
|
- lib
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: 1.3.1
|
69
69
|
requirements: []
|
70
70
|
rubygems_version: 3.1.4
|
71
|
-
signing_key:
|
71
|
+
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Wmctrl plugin for Fusuma
|
74
74
|
test_files: []
|