fusuma-plugin-wmctrl 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/README.md +15 -4
- data/lib/fusuma/plugin/executors/wmctrl_executor.rb +53 -12
- data/lib/fusuma/plugin/wmctrl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f32faf629716120700464642e1d591691413d7240e1000c2774514a57402b8d
|
4
|
+
data.tar.gz: 46b22611de856c05893885e04fb0e38769b7f5cda314776484cd9983fc24c38e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb007ac0e18cc78797e3211c269c279f4da0af4f0d8c0e95129108b533d6dc6f117800efdc751cc9b5a2ad6ab4feff9a308abb11c7f0d3d6d4ef5b81634b9a30
|
7
|
+
data.tar.gz: 5a2287cce23e47ed30153cc6668edce591695093c8a5323a8b0472ead69d6a9372b744be810d24ef38980d71ac5fa33300723b95cbd3a9f8c90797a628e59d2b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Fusuma::Plugin::Wmctrl
|
1
|
+
# Fusuma::Plugin::Wmctrl [![Gem Version](https://badge.fury.io/rb/fusuma-plugin-wmctrl.svg)](https://badge.fury.io/rb/fusuma-plugin-wmctrl) [![Build Status](https://travis-ci.com/iberianpig/fusuma-plugin-wmctrl.svg?branch=master)](https://travis-ci.com/iberianpig/fusuma-plugin-wmctrl)
|
2
|
+
|
2
3
|
|
3
4
|
Window Manager plugin for [Fusuma](https://github.com/iberianpig/fusuma)
|
4
5
|
|
@@ -21,11 +22,21 @@ $ gem install fusuma-plugin-wmctrl
|
|
21
22
|
|
22
23
|
## Properties
|
23
24
|
|
25
|
+
### `workspace:` property
|
24
26
|
Add `workspace:` property in `~/.config/fusuma/config.yml`.
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
* `
|
28
|
+
Values following are available for `workspace`.
|
29
|
+
|
30
|
+
* `prev` is value to switch current workspace to previous workspace.
|
31
|
+
* `next` is value to switch current workspace to next workspace.
|
32
|
+
|
33
|
+
### `window:` property for moving active window
|
34
|
+
Add `window:` property in `~/.config/fusuma/config.yml`.
|
35
|
+
|
36
|
+
Values following are available for `window`.
|
37
|
+
|
38
|
+
* `prev` is value to move active window to previous workspace.
|
39
|
+
* `next` is value to move active window to next workspace.
|
29
40
|
|
30
41
|
|
31
42
|
## Example
|
@@ -11,6 +11,7 @@ module Fusuma
|
|
11
11
|
def execute(event)
|
12
12
|
return if search_command(event).nil?
|
13
13
|
|
14
|
+
MultiLogger.info(wmctrl: search_command(event))
|
14
15
|
pid = fork do
|
15
16
|
Process.daemon(true)
|
16
17
|
exec(search_command(event))
|
@@ -32,11 +33,33 @@ module Fusuma
|
|
32
33
|
# @return [String]
|
33
34
|
# @return [NilClass]
|
34
35
|
def search_command(event)
|
36
|
+
search_workspace_command(event) || search_window_command(event)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# @param event [Event]
|
42
|
+
# @return [String]
|
43
|
+
# @return [NilClass]
|
44
|
+
def search_workspace_command(event)
|
35
45
|
index = Config::Index.new([*event.record.index.keys, :workspace])
|
46
|
+
|
36
47
|
direction = Config.search(index)
|
37
48
|
return if direction.nil?
|
38
49
|
|
39
|
-
Workspace.
|
50
|
+
Workspace.move_command(direction: direction)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param event [Event]
|
54
|
+
# @return [String]
|
55
|
+
# @return [NilClass]
|
56
|
+
def search_window_command(event)
|
57
|
+
index = Config::Index.new([*event.record.index.keys, :window])
|
58
|
+
|
59
|
+
direction = Config.search(index)
|
60
|
+
return if direction.nil?
|
61
|
+
|
62
|
+
Window.move_command(direction: direction)
|
40
63
|
end
|
41
64
|
|
42
65
|
# Manage workspace
|
@@ -49,17 +72,35 @@ module Fusuma
|
|
49
72
|
text.chars.first.to_i
|
50
73
|
end
|
51
74
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"wmctrl -s #{
|
75
|
+
def move_command(direction:)
|
76
|
+
workspace_num = case direction
|
77
|
+
when 'next'
|
78
|
+
current_workspace_num + 1
|
79
|
+
when 'prev'
|
80
|
+
current_workspace_num - 1
|
81
|
+
else
|
82
|
+
warn "#{direction} is invalid key"
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
"wmctrl -s #{workspace_num}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Manage Window
|
91
|
+
class Window
|
92
|
+
class << self
|
93
|
+
def move_command(direction:)
|
94
|
+
workspace_num = case direction
|
95
|
+
when 'next'
|
96
|
+
Workspace.current_workspace_num + 1
|
97
|
+
when 'prev'
|
98
|
+
Workspace.current_workspace_num - 1
|
99
|
+
else
|
100
|
+
warn "#{direction} is invalid key"
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
"wmctrl -r :ACTIVE: -t #{workspace_num} ; wmctrl -s #{workspace_num}"
|
63
104
|
end
|
64
105
|
end
|
65
106
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fusuma
|