fusuma-plugin-wmctrl 0.1.0 → 0.2.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: 316ce994f0890c7b67dbb07ca8305fcc47c3fa715adc693991d3fe809aa8b808
4
- data.tar.gz: 3f77d3c20e4e832adf3f40782cd1cbd9005064159575805d97e5e02193fafb63
3
+ metadata.gz: 2f32faf629716120700464642e1d591691413d7240e1000c2774514a57402b8d
4
+ data.tar.gz: 46b22611de856c05893885e04fb0e38769b7f5cda314776484cd9983fc24c38e
5
5
  SHA512:
6
- metadata.gz: '0888f8dfab2a61cd9dcd71b231da45804f6ea93fc8bc2ae03dd4cbd56eac13f7f46f3df0ac1bf311ede6e531f677ca439364175744bb3338478137a99b423811'
7
- data.tar.gz: 616aa9662f061ceb728007daccbee5520839d043af29715a635420738d3f5b8a3b39ad68a557ba23966db39c07595059ed2bf09ebc15c0e828426fb9837e7b7b
6
+ metadata.gz: eb007ac0e18cc78797e3211c269c279f4da0af4f0d8c0e95129108b533d6dc6f117800efdc751cc9b5a2ad6ab4feff9a308abb11c7f0d3d6d4ef5b81634b9a30
7
+ data.tar.gz: 5a2287cce23e47ed30153cc6668edce591695093c8a5323a8b0472ead69d6a9372b744be810d24ef38980d71ac5fa33300723b95cbd3a9f8c90797a628e59d2b
data/.travis.yml CHANGED
@@ -3,5 +3,8 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.4.1
7
- before_install: gem install bundler -v 2.0.1
6
+ - 2.3.1
7
+ - 2.4
8
+ - 2.5
9
+ - 2.6
10
+ before_install: gem install bundler --no-document -v 2.0.1
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
- Currently, values following are available for `workspace`.
27
- * `prev`
28
- * `next`
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.move_workspace_command(direction: direction)
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 move_workspace_command(direction:)
53
- new_workspace_num = case direction
54
- when 'next'
55
- current_workspace_num + 1
56
- when 'prev'
57
- current_workspace_num - 1
58
- else
59
- warn "#{direction} is invalid key"
60
- exit 1
61
- end
62
- "wmctrl -s #{new_workspace_num}"
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
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Wmctrl
6
- VERSION = '0.1.0'
6
+ VERSION = '0.2.0'
7
7
  end
8
8
  end
9
9
  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.1.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-10-12 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusuma