fusuma-plugin-wmctrl 0.2.0 → 0.3.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: 2f32faf629716120700464642e1d591691413d7240e1000c2774514a57402b8d
4
- data.tar.gz: 46b22611de856c05893885e04fb0e38769b7f5cda314776484cd9983fc24c38e
3
+ metadata.gz: 2539c743a8db6735904353675fd05f91d09e5d264a849badb9d6482407bc21ab
4
+ data.tar.gz: ec4941b7f2ed5271cbb0920c07733503e2339ccf07d4b8706ff553ce547c54b4
5
5
  SHA512:
6
- metadata.gz: eb007ac0e18cc78797e3211c269c279f4da0af4f0d8c0e95129108b533d6dc6f117800efdc751cc9b5a2ad6ab4feff9a308abb11c7f0d3d6d4ef5b81634b9a30
7
- data.tar.gz: 5a2287cce23e47ed30153cc6668edce591695093c8a5323a8b0472ead69d6a9372b744be810d24ef38980d71ac5fa33300723b95cbd3a9f8c90797a628e59d2b
6
+ metadata.gz: 754d2fe9d62cd2df08a99bb9fc16ffd32db2e6e92cd8de4005b4d341634c5dfa20610ff19308f18db1e48ce0c2d9fb1bccd56afb1b1df5502ed2864ba11409eb
7
+ data.tar.gz: 472916ac385ec8b18f2410f5820d7e0a7543d97b43827268df8e8f740bb007ff16fffd41945ac35a6c12e51506203a8bbf01d2faa1883b13ddbf189a0abfaf42
@@ -0,0 +1,20 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-01-02 00:51:24 +0900 using RuboCop version 0.75.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Metrics/AbcSize:
11
+ Max: 17
12
+
13
+ # Offense count: 1
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 8
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: CountComments, ExcludedMethods.
19
+ Metrics/MethodLength:
20
+ Max: 17
@@ -1,5 +1,21 @@
1
1
  # Change Log
2
2
 
3
+ ## [Unreleased](https://github.com/iberianpig/fusuma-plugin-wmctrl/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-wmctrl/compare/v0.2.0...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Control active window \(Close / Minimize / Maximize\) [\#2](https://github.com/iberianpig/fusuma-plugin-wmctrl/issues/2)
10
+
11
+ ## [v0.2.0](https://github.com/iberianpig/fusuma-plugin-wmctrl/tree/v0.2.0) (2019-11-07)
12
+ [Full Changelog](https://github.com/iberianpig/fusuma-plugin-wmctrl/compare/v0.1.0...v0.2.0)
13
+
14
+ **Implemented enhancements:**
15
+
16
+ - Move active window to next/prev workspace [\#1](https://github.com/iberianpig/fusuma-plugin-wmctrl/issues/1)
17
+
18
+ ## [v0.1.0](https://github.com/iberianpig/fusuma-plugin-wmctrl/tree/v0.1.0) (2019-10-12)
3
19
 
4
20
 
5
21
  \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  Window Manager plugin for [Fusuma](https://github.com/iberianpig/fusuma)
5
5
 
6
+ * Move window or workspace instead of xdotool
7
+ * Works on Wayland(Not depends on xdotool)
8
+
6
9
  ## Installation
7
10
 
8
11
  Run the following code in your terminal.
@@ -25,7 +25,7 @@ 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&section=main
28
- spec.add_dependency 'fusuma', '~> 1.0'
28
+ spec.add_dependency 'fusuma', '~> 1.3'
29
29
 
30
30
  spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
@@ -45,7 +45,7 @@ module Fusuma
45
45
  index = Config::Index.new([*event.record.index.keys, :workspace])
46
46
 
47
47
  direction = Config.search(index)
48
- return if direction.nil?
48
+ return unless direction.is_a?(String)
49
49
 
50
50
  Workspace.move_command(direction: direction)
51
51
  end
@@ -56,10 +56,22 @@ module Fusuma
56
56
  def search_window_command(event)
57
57
  index = Config::Index.new([*event.record.index.keys, :window])
58
58
 
59
- direction = Config.search(index)
60
- return if direction.nil?
61
-
62
- Window.move_command(direction: direction)
59
+ case property = Config.search(index)
60
+ when 'prev', 'next'
61
+ Window.move_command(direction: property)
62
+ when 'fullscreen'
63
+ Window.fullscreen(method: 'toggle')
64
+ when 'maximized'
65
+ Window.maximized(method: 'toggle')
66
+ when 'close'
67
+ Window.close
68
+ when Hash
69
+ if property[:fullscreen]
70
+ Window.fullscreen(method: property[:fullscreen])
71
+ elsif property[:maximized]
72
+ Window.maximized(method: property[:maximized])
73
+ end
74
+ end
63
75
  end
64
76
 
65
77
  # Manage workspace
@@ -79,8 +91,7 @@ module Fusuma
79
91
  when 'prev'
80
92
  current_workspace_num - 1
81
93
  else
82
- warn "#{direction} is invalid key"
83
- exit 1
94
+ raise "#{direction} is invalid key"
84
95
  end
85
96
  "wmctrl -s #{workspace_num}"
86
97
  end
@@ -90,6 +101,20 @@ module Fusuma
90
101
  # Manage Window
91
102
  class Window
92
103
  class << self
104
+ # @param method [String] "toggle" or "add" or "remove"
105
+ def maximized(method:)
106
+ "wmctrl -r :ACTIVE: -b #{method},maximized_vert,maximized_horz"
107
+ end
108
+
109
+ def close
110
+ 'wmctrl -c :ACTIVE:'
111
+ end
112
+
113
+ # @param method [String] "toggle" or "add" or "remove"
114
+ def fullscreen(method:)
115
+ "wmctrl -r :ACTIVE: -b #{method},fullscreen"
116
+ end
117
+
93
118
  def move_command(direction:)
94
119
  workspace_num = case direction
95
120
  when 'next'
@@ -97,8 +122,7 @@ module Fusuma
97
122
  when 'prev'
98
123
  Workspace.current_workspace_num - 1
99
124
  else
100
- warn "#{direction} is invalid key"
101
- exit 1
125
+ raise "#{direction} is invalid key"
102
126
  end
103
127
  "wmctrl -r :ACTIVE: -t #{workspace_num} ; wmctrl -s #{workspace_num}"
104
128
  end
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Wmctrl
6
- VERSION = '0.2.0'
6
+ VERSION = '0.3.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.2.0
4
+ version: 0.3.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-07 00:00:00.000000000 Z
11
+ date: 2020-01-03 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: '1.0'
19
+ version: '1.3'
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: '1.0'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement