uh-wm 0.2.1 → 0.2.2

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
- SHA1:
3
- metadata.gz: 4f89b584c49ab089cb76ac61c10f9383151005b7
4
- data.tar.gz: 67b389410be855c1c38c456824b26f9254fd8fcd
2
+ SHA256:
3
+ metadata.gz: bdfaa9044850872fdb32698f87fe8323e5e846519b6c6bec7815db47169ca8d1
4
+ data.tar.gz: b5fc6c161f4c491d6cf80f32eaa7ea2f494c21bda689424baa3bb7e6ea4628f0
5
5
  SHA512:
6
- metadata.gz: 8a998780ee5f376ac50fb6611452f938344083de3d47881ad70131eedf398d4a1ed7d069d37e574ac3d4fc8666e219bb01b803eff2fdae1f6b6c7198b0c4627b
7
- data.tar.gz: 0d1877cb56acd61d78652645606baf1e8f3f9bea393eba673fc70d00c588382a1a68b104a75d54e26a3067cbaeaac29fe2e2962634c3a43106314e346167da86
6
+ metadata.gz: c36a250861f7afa38a3fef39a72979d71576bfd71083e46e7405d42c4c050fa38f21374b8abbcbac6485c39c5c51bf9a240a5d08d4db073f8e229f496b7c70f0
7
+ data.tar.gz: fcfe9ec464a7ee86e725bb2fd93c02151d429057764fe987db90ceee1887adcb1aec4770ea3dbc571a9a3ebc86a9e967c4f90dd679b780725c2711795532b896
data/README.md CHANGED
@@ -7,7 +7,7 @@ directly with ruby code.
7
7
 
8
8
  The layout behavior can be changed, the default one being
9
9
  implemented by the `uh-layout` ruby gem. A layout is a simple ruby
10
- object responding to specific messages, so you can wrote your own in
10
+ object responding to specific messages, so you can write your own in
11
11
  plain ruby without any dependency.
12
12
 
13
13
  Main features:
@@ -16,7 +16,7 @@ plain ruby without any dependency.
16
16
  * different adapters for event handling: blocking, multiplexing
17
17
  with `select()` or `kqueue()`;
18
18
  * configuration with a run control file;
19
- * key bindings with user defined code as callback;
19
+ * key bindings with user defined callbacks;
20
20
  * configurable modifier key;
21
21
  * user-defined layout behavior (ruby);
22
22
  * external program execution;
@@ -67,8 +67,7 @@ BROWSERS = %w[
67
67
 
68
68
  modifier :mod1 # This key is added to the modifier mask for *all*
69
69
  # key bindings.
70
- key(:p) { execute DMENU } # Execute given command in a shell when mod1+shift
71
- # is pressed.
70
+ key(:p) { execute DMENU } # Execute given command in a shell with mod1+p.
72
71
  key(:Q) { quit } # Quit when mod1+shift+q is pressed (a capitalized
73
72
  # key adds shift to mod mask).
74
73
  key(:enter) { execute VT } # Common key names (`enter') are translated to
@@ -68,16 +68,16 @@ module Uh
68
68
  end
69
69
 
70
70
  # Forwards unhandled messages prefixed with `layout_` to the layout,
71
- # without the prefix
71
+ # replacing the prefix with `handle_`
72
72
  # @example
73
- # layout_foo # delegates to `layout.foo'
73
+ # layout_foo # delegates to `layout.handle_foo'
74
74
  def method_missing m, *args, &block
75
75
  if respond_to? m
76
76
  meth = layout_method m
77
77
  log "#{layout.class.name}##{meth} #{args.inspect}"
78
- begin
78
+ if layout.respond_to? meth
79
79
  layout.send meth, *args
80
- rescue NoMethodError
80
+ else
81
81
  log_error "Layout does not implement `#{meth}'"
82
82
  end
83
83
  else
@@ -100,7 +100,7 @@ module Uh
100
100
  private
101
101
 
102
102
  def layout_method m
103
- m.to_s.gsub(/\Alayout_/, 'handle_').to_sym
103
+ m.to_s.sub(/\Alayout_/, 'handle_').to_sym
104
104
  end
105
105
  end
106
106
  end
data/lib/uh/wm/env.rb CHANGED
@@ -24,7 +24,7 @@ module Uh
24
24
  attr_accessor :rc_path, :modifier, :modifier_ignore, :worker, :layout,
25
25
  :layout_class, :layout_options, :rules, :launch
26
26
 
27
- def initialize output: $stdout, **_
27
+ def initialize **_
28
28
  super
29
29
  @rc_path = RC_PATH
30
30
  @modifier = MODIFIER
@@ -75,7 +75,7 @@ module Uh
75
75
  # @param arg [Class, Object, Hash] A layout class, a layout instance, or
76
76
  # options for the default layout
77
77
  # @param options [Hash] Layout options
78
- def layout arg, **options
78
+ def layout arg, options = {}
79
79
  case arg
80
80
  when Class
81
81
  if options.any?
@@ -144,7 +144,7 @@ module Uh
144
144
  translated_keysym = KEYSYM_TRANSLATIONS.key?(translate_key) ?
145
145
  KEYSYM_TRANSLATIONS[translate_key] :
146
146
  translate_key
147
- keysym =~ /[A-Z]/ ? [translated_keysym, :shift] : translated_keysym
147
+ keysym.to_s =~ /[A-Z]/ ? [translated_keysym, :shift] : translated_keysym
148
148
  end
149
149
  end
150
150
  end
@@ -1,4 +1,4 @@
1
- require 'baf/testing/cucumber/steps/output_wait'
1
+ require 'baf/testing/process'
2
2
 
3
3
  require 'uh'
4
4
  require 'uh/wm/testing/x_client'
@@ -13,7 +13,8 @@ module Uh
13
13
  attr_reader :other_wm
14
14
 
15
15
  def icccm_window_start
16
- @icccm_window = ChildProcess.build(*%w[xmessage window])
16
+ @icccm_window = Baf::Testing::Process.new %w[xmessage window],
17
+ env_allow: %w[DISPLAY]
17
18
  @icccm_window.start
18
19
  end
19
20
 
@@ -33,20 +34,21 @@ module Uh
33
34
  uhwm_request_quit
34
35
  end
35
36
 
36
- def uhwm_wait_ready
37
- wait_output! LOG_READY
38
- end
39
-
40
37
  def uhwm_run_wait_ready options = '-v'
41
- program_run wait: false, opts: options
42
- uhwm_wait_ready
38
+ cmd = $_baf[:program] + options.split(' ')
39
+ env = Baf::Testing::ENV_WHITELIST + $_baf[:env_allow]
40
+ Baf::Testing::Process.new(cmd, env_allow: env).tap do |uhwm|
41
+ uhwm.start
42
+ Baf::Testing.wait_output LOG_READY, stream: -> { uhwm.output }
43
+ end
43
44
  end
44
45
 
45
- def with_other_wm
46
- @other_wm = ChildProcess.build('./bin/uhwm')
46
+ def with_other_wm uhwm_command
47
+ env = Baf::Testing::ENV_WHITELIST + $_baf[:env_allow]
48
+ @other_wm = Baf::Testing::Process.new uhwm_command, env_allow: env
47
49
  @other_wm.start
48
50
  yield
49
- @other_wm.stop
51
+ uhwm_request_quit
50
52
  @other_wm = nil
51
53
  end
52
54
 
@@ -1,4 +1,4 @@
1
- require 'childprocess'
1
+ require 'baf/testing/process'
2
2
 
3
3
  module Uh
4
4
  module WM
@@ -8,15 +8,18 @@ module Uh
8
8
  DISPLAY_SCREEN = '640x480x24'
9
9
 
10
10
  def with_xvfb
11
- xvfb = ChildProcess.build(*%W[
11
+ xvfb = Baf::Testing::Process.new %W[
12
12
  Xvfb -ac #{DISPLAY_NAME} -screen 0 #{DISPLAY_SCREEN}
13
- ])
13
+ ]
14
14
  xvfb.start
15
15
  original_display = ENV['DISPLAY']
16
16
  ENV['DISPLAY'] = DISPLAY_NAME
17
- yield
18
- ENV['DISPLAY'] = original_display
19
- xvfb.stop
17
+ begin
18
+ yield
19
+ ensure
20
+ ENV['DISPLAY'] = original_display
21
+ xvfb.stop
22
+ end
20
23
  end
21
24
  end
22
25
  end
@@ -26,7 +26,7 @@ module Uh
26
26
  end
27
27
 
28
28
  def window_id
29
- @window.id
29
+ window.id
30
30
  end
31
31
 
32
32
  def window_name
data/lib/uh/wm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Uh
2
2
  module WM
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ module Uh
4
4
  class Base
5
5
  CALLBACKS = %w[before_watch on_timeout on_read on_read_next].freeze
6
6
 
7
- def initialize **_options
7
+ def initialize *_options
8
8
  @ios = []
9
9
  end
10
10
 
data/lib/uh/wm/workers.rb CHANGED
@@ -2,9 +2,9 @@ module Uh
2
2
  module WM
3
3
  module Workers
4
4
  FACTORIES = {
5
- block: ->(options) { Blocking.new(options) },
6
- kqueue: ->(options) { KQueue.new(options) },
7
- mux: ->(options) { Mux.new(options) }
5
+ block: ->(options) { Blocking.new(**options) },
6
+ kqueue: ->(options) { KQueue.new(**options) },
7
+ mux: ->(options) { Mux.new(**options) }
8
8
  }.freeze
9
9
 
10
10
  class << self
@@ -16,7 +16,7 @@ module Uh
16
16
  FACTORIES.key? type
17
17
  end
18
18
 
19
- def build type, **options
19
+ def build type, options = {}
20
20
  (FACTORIES[type] or fail ArgumentError, "unknown worker: `#{type}'")
21
21
  .call options
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uh-wm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-22 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: baf
@@ -79,33 +79,47 @@ dependencies:
79
79
  - !ruby/object:Gem::Version
80
80
  version: 0.4.2
81
81
  - !ruby/object:Gem::Dependency
82
- name: rake
82
+ name: cucumber
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '10'
87
+ version: '3.2'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '10'
94
+ version: '3.2'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rake
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
95
109
  - !ruby/object:Gem::Dependency
96
- name: baf-testing
110
+ name: rspec
97
111
  requirement: !ruby/object:Gem::Requirement
98
112
  requirements:
99
113
  - - "~>"
100
114
  - !ruby/object:Gem::Version
101
- version: '0.0'
115
+ version: '3.11'
102
116
  type: :development
103
117
  prerelease: false
104
118
  version_requirements: !ruby/object:Gem::Requirement
105
119
  requirements:
106
120
  - - "~>"
107
121
  - !ruby/object:Gem::Version
108
- version: '0.0'
122
+ version: '3.11'
109
123
  description: |2
110
124
  uhwm is a minimalistic tiling and stacking window manager for X. It
111
125
  shares some similarities with dwm and wmii, but is written in ruby so
@@ -145,7 +159,7 @@ homepage: https://rubygems.org/gems/uh-wm
145
159
  licenses:
146
160
  - BSD-3-Clause
147
161
  metadata: {}
148
- post_install_message:
162
+ post_install_message:
149
163
  rdoc_options: []
150
164
  require_paths:
151
165
  - lib
@@ -160,9 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
174
  - !ruby/object:Gem::Version
161
175
  version: '0'
162
176
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.6.14
165
- signing_key:
177
+ rubygems_version: 3.3.17
178
+ signing_key:
166
179
  specification_version: 4
167
180
  summary: minimalistic tiling and stacking X window manager
168
181
  test_files: []