uh-wm 0.0.15 → 0.1.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 +4 -4
- data/README.md +13 -276
- data/lib/uh/wm.rb +3 -2
- data/lib/uh/wm/actions_handler.rb +3 -3
- data/lib/uh/wm/cli.rb +5 -6
- data/lib/uh/wm/dispatcher.rb +1 -2
- data/lib/uh/wm/launcher.rb +1 -3
- data/lib/uh/wm/logger_formatter.rb +1 -1
- data/lib/uh/wm/manager.rb +1 -2
- data/lib/uh/wm/run_control.rb +1 -2
- data/lib/uh/wm/runner.rb +2 -32
- data/lib/uh/wm/testing/acceptance_helpers.rb +9 -18
- data/lib/uh/wm/testing/x_client.rb +2 -3
- data/lib/uh/wm/version.rb +1 -1
- data/lib/uh/wm/workers/base.rb +1 -1
- data/lib/uh/wm/workers/kqueue.rb +1 -2
- data/lib/uh/wm/x_event_logger.rb +31 -0
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 959239c4e633cdfa25d86371729560ddf40afa4a
|
4
|
+
data.tar.gz: 704626fb3cfe89b8ea8d84fe5f6e1200d9000ffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2a06d4832cfff8ffdb1ed5bf6c59f999b51c8d6e3f055f449e5414be799fd0c88beaf0b054a0c9054d0930d0bfb5a170fc1b5090966c3f60f90b1a9778de3ff
|
7
|
+
data.tar.gz: 5f96afa7bc57f3ea5e48dc7a8ba8544b9472b29957c06ef0a760a3ba8423c6d0ce26614e2cee2f9e1f70e57aa3253ff724962f2c9b4bfcd8043bda5953442cb7
|
data/README.md
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
uhwm
|
2
2
|
====
|
3
3
|
|
4
|
-
[![Version ][badge-version-img]][badge-version-uri]
|
5
|
-
[![Build status ][badge-build-img]][badge-build-uri]
|
6
|
-
[![Code Climate ][badge-cclimate-img]][badge-cclimate-uri]
|
7
|
-
|
8
|
-
|
9
4
|
uhwm is a minimalistic tiling and stacking window manager for X. It
|
10
|
-
|
11
|
-
|
5
|
+
is mostly written in ruby so you can configure and extend features
|
6
|
+
directly with ruby code.
|
12
7
|
|
13
|
-
The layout
|
14
|
-
`uh-layout` ruby gem. A layout is a simple ruby
|
15
|
-
specific messages, so
|
8
|
+
The layout behavior can be changed, the default one being
|
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
|
11
|
+
plain ruby without any dependency.
|
16
12
|
|
17
13
|
Main features:
|
18
14
|
|
@@ -22,7 +18,7 @@ specific messages, so it's easy to write your own layout.
|
|
22
18
|
* configuration with a run control file;
|
23
19
|
* key bindings with user defined code as callback;
|
24
20
|
* configurable modifier key;
|
25
|
-
* user-defined layout
|
21
|
+
* user-defined layout behavior (ruby);
|
26
22
|
* external program execution;
|
27
23
|
* no re-parenting (therefore, no window decoration either);
|
28
24
|
* no grabbing of the modifier key alone;
|
@@ -36,29 +32,15 @@ Installation
|
|
36
32
|
------------
|
37
33
|
|
38
34
|
uhwm requires ruby ~> 2.1 with rubygems, and is currently
|
39
|
-
distributed as the `uh-wm` ruby gem
|
35
|
+
distributed as the `uh-wm` ruby gem and the `x11-wm/rubygem-uh-wm`
|
36
|
+
FreeBSD port.
|
40
37
|
|
41
38
|
``` shell
|
42
39
|
gem install uh-wm # install the gem or update to last release
|
43
40
|
```
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
-----
|
48
|
-
|
49
|
-
```
|
50
|
-
Usage: uhwm [options]
|
51
|
-
|
52
|
-
options:
|
53
|
-
-v, --verbose enable verbose mode
|
54
|
-
-d, --debug enable debug mode
|
55
|
-
-f, --run-control PATH specify alternate run control file
|
56
|
-
-r, --require PATH require ruby feature
|
57
|
-
-l, --layout LAYOUT specify layout
|
58
|
-
-w, --worker WORKER specify worker
|
59
|
-
|
60
|
-
-h, --help print this message
|
61
|
-
-V, --version print version
|
42
|
+
``` shell
|
43
|
+
pkg install x11-wm/rubygem-uh-wm # use the FreeBSD port
|
62
44
|
```
|
63
45
|
|
64
46
|
|
@@ -105,7 +87,7 @@ end
|
|
105
87
|
|
106
88
|
Blocks given to `key`, `rule`, `launch` are executed in a special
|
107
89
|
context providing access to methods named "actions", which are
|
108
|
-
described in the
|
90
|
+
described in the "Actions" section of this file.
|
109
91
|
|
110
92
|
[run_control_doc]: http://www.rubydoc.info/gems/uh-wm/Uh/WM/RunControl
|
111
93
|
|
@@ -130,250 +112,19 @@ available in the [`ActionsHandler` class documentation][actions_doc]
|
|
130
112
|
[actions_doc]: http://www.rubydoc.info/gems/uh-wm/Uh/WM/ActionsHandler
|
131
113
|
|
132
114
|
|
133
|
-
Hacking uhwm
|
134
|
-
------------
|
135
|
-
|
136
|
-
If you need to work with uhwm source code, you will need a local clone
|
137
|
-
of the repository. A bundler `Gemfile` is provided, and if you are new
|
138
|
-
to ruby and rubygems, we recommend that you use bundler to manage
|
139
|
-
dependencies. Refer to the bundler documentation if you need no know
|
140
|
-
more than this short help:
|
141
|
-
|
142
|
-
* Run `bundle install` after you update the repository sources to a
|
143
|
-
new version, or when you changes branches which affect the
|
144
|
-
`Gemfile`
|
145
|
-
* Prefix every ruby executable scripts (`bin/uhwm`, `rake`…) with
|
146
|
-
`bundle exec`, for example `bundle exec rake spec`
|
147
|
-
|
148
|
-
Please note this not the "supported" way of using uhwm, we recommend
|
149
|
-
that you use the ruby gem. The `master` branch can sometimes receive
|
150
|
-
experimental features which may need improvements before a stable gem
|
151
|
-
release.
|
152
|
-
|
153
|
-
### Installation with bundler
|
154
|
-
|
155
|
-
``` shell
|
156
|
-
git clone git://github.com/tjouan/uh-wm # clone repository from github mirror
|
157
|
-
bundle install # install dependencies with bundler
|
158
|
-
```
|
159
|
-
|
160
|
-
### Running the test suite
|
161
|
-
|
162
|
-
``` shell
|
163
|
-
rake # Run all test suites
|
164
|
-
rake features # Run user acceptance test suite
|
165
|
-
cucumber # Run user acceptance test suite
|
166
|
-
rake spec # Run unit test suite
|
167
|
-
rspec # Run unit test suite
|
168
|
-
```
|
169
|
-
|
170
|
-
Prefix the commands as `bundle exec COMMAND` if you're using
|
171
|
-
bundler.
|
172
|
-
|
173
|
-
### Running uhwm within a nested X session
|
174
|
-
|
175
|
-
For convenience, the `run` rake task is provided to execute uhwm in
|
176
|
-
a new X session using Xephyr as the X server. The session is
|
177
|
-
initialized with the `startx` program, the task will import the keymap
|
178
|
-
from your current X session to the new one and change the background
|
179
|
-
color to one that is neither used by uhwm nor commonly used by other.
|
180
|
-
|
181
|
-
``` shell
|
182
|
-
# Run uhwm (with default argument `-d', set by the task internally)
|
183
|
-
rake run
|
184
|
-
# Run uhwm with no argument
|
185
|
-
rake run --
|
186
|
-
# Run uhwm with `-v' argument
|
187
|
-
rake run -- -v
|
188
|
-
# Setup Xephyr with two screens
|
189
|
-
rake run UHWM_XINERAMA=yes
|
190
|
-
# Combine custom env and custom uhwm arguments
|
191
|
-
rake run UHWM_XINERAMA=yes -- -v
|
192
|
-
```
|
193
|
-
|
194
|
-
|
195
|
-
Extensive configuration example
|
196
|
-
-------------------------------
|
197
|
-
|
198
|
-
``` ruby
|
199
|
-
COLORS = {
|
200
|
-
bg: 'rgb:0c/0c/0c'.freeze,
|
201
|
-
fg: 'rgb:d0/d0/d0'.freeze,
|
202
|
-
sel: 'rgb:d7/00/5f'.freeze,
|
203
|
-
hi: 'rgb:82/00/3a'.freeze
|
204
|
-
}.freeze
|
205
|
-
DMENU = ('dmenu_run -b -nb %s -nf %s -sb %s -sf %s' %
|
206
|
-
COLORS.values_at(:bg, :fg, :sel, :fg)).freeze
|
207
|
-
VT = 'urxvt'.freeze
|
208
|
-
VT_SHELL = "#{VT} -e zsh -i -c".freeze
|
209
|
-
LOCKER = 'xautolock -locknow &'.freeze
|
210
|
-
BROWSERS = %w[
|
211
|
-
arora chrome chromium firebird firefox galeon iceweasel konqueror pentadactyl
|
212
|
-
phoenix vimperator
|
213
|
-
].freeze
|
214
|
-
DATETIME = -> { Time.new.strftime('%FT%T %a') }.freeze
|
215
|
-
|
216
|
-
|
217
|
-
worker :kqueue, timeout: 1
|
218
|
-
modifier :mod1
|
219
|
-
layout colors: COLORS, bar_status: DATETIME
|
220
|
-
|
221
|
-
key(:Q) { quit }
|
222
|
-
key(:z) { execute LOCKER }
|
223
|
-
|
224
|
-
key(:enter) { execute VT }
|
225
|
-
key(:p) { execute DMENU }
|
226
|
-
|
227
|
-
key(:c) { layout_screen_sel :succ }
|
228
|
-
key(:C) { layout_screen_set :succ }
|
229
|
-
(0..9).each { |e| key(e) { layout_view_sel e } }
|
230
|
-
(0..9).each { |e| key(e, :shift) { layout_view_set e } }
|
231
|
-
key(:w) { layout_view_sel 'www' }
|
232
|
-
key(:W) { layout_view_set 'www' }
|
233
|
-
key(:h) { layout_column_sel :pred }
|
234
|
-
key(:s) { layout_column_sel :succ }
|
235
|
-
key(:n) { layout_client_sel :pred }
|
236
|
-
key(:t) { layout_client_sel :succ }
|
237
|
-
key(:d) { layout_column_mode_toggle }
|
238
|
-
key(:N) { layout_client_swap :pred }
|
239
|
-
key(:T) { layout_client_swap :succ }
|
240
|
-
key(:H) { layout_client_column_set :pred }
|
241
|
-
key(:S) { layout_client_column_set :succ }
|
242
|
-
|
243
|
-
key(:tab) { layout_history_view_pred }
|
244
|
-
|
245
|
-
key(:e) { kill_current }
|
246
|
-
|
247
|
-
key(:apostrophe) { execute 'mocp --toggle-pause' }
|
248
|
-
key(:comma) { execute 'mixer vol -3' }
|
249
|
-
key(:period) { execute 'mixer vol +3' }
|
250
|
-
key(:Apostrophe) { execute 'mocp --seek 30' }
|
251
|
-
key(:Comma) { execute 'mocp --previous' }
|
252
|
-
key(:Period) { execute 'mocp --next' }
|
253
|
-
|
254
|
-
key(:l) { log_layout }
|
255
|
-
key(:L) { log_client }
|
256
|
-
key(:backspace) { log_separator }
|
257
|
-
|
258
|
-
if ENV['DISPLAY'] == ':42'
|
259
|
-
key(:q) { quit }
|
260
|
-
key(:f) { execute VT }
|
261
|
-
key(:F) { execute 'firefox -P test' }
|
262
|
-
end
|
263
|
-
|
264
|
-
rule BROWSERS do
|
265
|
-
layout_view_set 'www'
|
266
|
-
next unless layout.current_view.columns.size == 1
|
267
|
-
next unless layout.current_view.clients.size >= 2
|
268
|
-
next unless layout.current_view.clients.any? { |c| c.wclass =~ /\A#{VT}/i }
|
269
|
-
layout_client_column_set :succ
|
270
|
-
end
|
271
|
-
|
272
|
-
rule VT do
|
273
|
-
next unless layout.current_view.columns.size == 1
|
274
|
-
next unless layout.current_view.clients.size >= 2
|
275
|
-
if layout.current_view.clients.all? { |c| c.wclass =~ /\A#{VT}/i }
|
276
|
-
layout_client_column_set :succ
|
277
|
-
elsif layout.current_view.clients.any? { |c| c.wclass =~ /\Afirefox/i }
|
278
|
-
layout_client_column_set :pred
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
rule 'xephyr' do
|
283
|
-
if layout.current_view.clients.select { |c| c.wclass =~ /\Axephyr/i }.size > 1
|
284
|
-
layout_screen_set :succ
|
285
|
-
layout_view_set 7
|
286
|
-
layout_view_sel 7
|
287
|
-
layout_screen_sel :pred
|
288
|
-
layout_screen_set :succ
|
289
|
-
layout_column_mode_toggle
|
290
|
-
else
|
291
|
-
layout_client_column_set :succ
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
launch do
|
296
|
-
layout_screen_sel :succ
|
297
|
-
|
298
|
-
layout_view_sel '2'
|
299
|
-
execute! "#{VT_SHELL} 'tail -F ~/.uhwm.log'"
|
300
|
-
|
301
|
-
layout_view_sel '1'
|
302
|
-
execute! "#{VT_SHELL} mutt"
|
303
|
-
layout_column_mode_toggle
|
304
|
-
execute! "#{VT_SHELL} 'mtr -n foo.example; exec zsh'"
|
305
|
-
execute! "#{VT_SHELL} 'mtr -n bar.example; exec zsh'"
|
306
|
-
|
307
|
-
execute! "#{VT_SHELL} 'ssh -t foo.example zsh -i -c \\\"tmux attach -t irc\\\"; exec zsh'"
|
308
|
-
layout_client_column_set :succ
|
309
|
-
|
310
|
-
execute! "#{VT_SHELL} 'ssh -t foo.example tmux attach -t log; exec zsh'"
|
311
|
-
layout_client_column_set :succ
|
312
|
-
layout_column_mode_toggle
|
313
|
-
execute! "#{VT_SHELL} 'ssh -t bar.example tmux attach -t log; exec zsh'"
|
314
|
-
execute! "#{VT_SHELL} 'tmux attach -t log; exec zsh'"
|
315
|
-
layout_column_sel :pred
|
316
|
-
|
317
|
-
layout_screen_sel :pred
|
318
|
-
|
319
|
-
execute! "#{VT_SHELL} mutt"
|
320
|
-
execute! "#{VT_SHELL} 'vim ~/TODO; exec zsh'"
|
321
|
-
layout_client_column_set :succ
|
322
|
-
execute! VT
|
323
|
-
layout_client_column_set :succ
|
324
|
-
|
325
|
-
layout_view_sel '2'
|
326
|
-
execute! "#{VT_SHELL} 'cd ~/src/.../uh-wm; exec zsh'"
|
327
|
-
execute! "#{VT_SHELL} 'cd ~/src/.../uh-wm; exec zsh'"
|
328
|
-
layout_client_column_set :pred
|
329
|
-
|
330
|
-
layout_view_sel '4'
|
331
|
-
execute! "#{VT_SHELL} mocp; exec zsh"
|
332
|
-
execute! VT
|
333
|
-
layout_client_column_set :succ
|
334
|
-
|
335
|
-
layout_view_sel '8'
|
336
|
-
execute! "#{VT_SHELL} 'top -o res; exec zsh'"
|
337
|
-
execute! VT
|
338
|
-
layout_client_column_set :succ
|
339
|
-
|
340
|
-
layout_view_sel '1'
|
341
|
-
end if ENV['DISPLAY'] == ':0'
|
342
|
-
|
343
|
-
launch do
|
344
|
-
layout_view_sel '2'
|
345
|
-
execute! "#{VT_SHELL} 'tail -F ~/.uhwm.log'"
|
346
|
-
|
347
|
-
layout_view_sel '1'
|
348
|
-
execute! "#{VT_SHELL} 'echo hello\!; exec zsh'"
|
349
|
-
execute! VT
|
350
|
-
layout_client_column_set :succ
|
351
|
-
end if ENV['DISPLAY'] == ':42'
|
352
|
-
```
|
353
|
-
|
354
|
-
|
355
115
|
BUGS
|
356
116
|
----
|
357
117
|
|
358
|
-
* Signal handling is broken under certain undocumented conditions.
|
359
|
-
|
360
118
|
* Unicode is not supported everywhere (the `uh` ruby gem does not yet
|
361
119
|
support unicode text drawing).
|
362
120
|
|
363
|
-
* Column width in default layout is hard coded.
|
364
|
-
|
365
121
|
|
366
122
|
FAQ
|
367
123
|
---
|
368
124
|
|
369
|
-
_uhwm is stealing focus, how can I avoid this behavior?_
|
370
|
-
|
371
|
-
You can't (yet). The default layout will be modified to accept an
|
372
|
-
`autofocus: false` option in a future release.
|
373
|
-
|
374
125
|
_What are the default key bindings?_
|
375
126
|
|
376
|
-
|
127
|
+
Just one: `mod+shift+q` is bound to the `quit` action.
|
377
128
|
|
378
129
|
_How can I implement my own layout?_
|
379
130
|
|
@@ -401,17 +152,3 @@ key :m do
|
|
401
152
|
end
|
402
153
|
end
|
403
154
|
```
|
404
|
-
_I get a \`cannot load such file -- uh/wm (LoadError)\` how do I fix?_
|
405
|
-
|
406
|
-
You are probably not using the gem. If you want to use uhwm from a
|
407
|
-
local git clone or if you did a custom install, try to use bundler or
|
408
|
-
to modify the ruby load path (set `RUBYOPT=-Ilib` for example).
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
[badge-version-img]: https://img.shields.io/gem/v/uh-wm.svg?style=flat-square
|
413
|
-
[badge-version-uri]: https://rubygems.org/gems/uh-wm
|
414
|
-
[badge-build-img]: https://img.shields.io/travis/tjouan/uh-wm/master.svg?style=flat-square
|
415
|
-
[badge-build-uri]: https://travis-ci.org/tjouan/uh-wm
|
416
|
-
[badge-cclimate-img]: https://img.shields.io/codeclimate/github/tjouan/uh-wm.svg?style=flat-square
|
417
|
-
[badge-cclimate-uri]: https://codeclimate.com/github/tjouan/uh-wm
|
data/lib/uh/wm.rb
CHANGED
@@ -22,6 +22,7 @@ require 'uh/wm/workers/base'
|
|
22
22
|
require 'uh/wm/workers/blocking'
|
23
23
|
require 'uh/wm/workers/kqueue' unless RbConfig::CONFIG['host_os'] =~ /linux/i
|
24
24
|
require 'uh/wm/workers/mux'
|
25
|
+
require 'uh/wm/x_event_logger'
|
25
26
|
|
26
27
|
module Uh
|
27
28
|
module WM
|
@@ -32,8 +33,8 @@ module Uh
|
|
32
33
|
RunControlArgumentError = Class.new(ArgumentError)
|
33
34
|
|
34
35
|
class OtherWMRunningError < RuntimeError
|
35
|
-
def
|
36
|
-
'another window manager is already running'
|
36
|
+
def initialize *_
|
37
|
+
super 'another window manager is already running'
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -17,7 +17,8 @@ module Uh
|
|
17
17
|
# @param env [Env] An environment
|
18
18
|
# @param events [Dispatcher] A dispatcher
|
19
19
|
def initialize env, events
|
20
|
-
@env
|
20
|
+
@env = env
|
21
|
+
@events = events
|
21
22
|
end
|
22
23
|
|
23
24
|
# Evaluates action code given as normal argument or block parameter
|
@@ -96,8 +97,7 @@ module Uh
|
|
96
97
|
m.to_s =~ /\Alayout_/ || super
|
97
98
|
end
|
98
99
|
|
99
|
-
|
100
|
-
private
|
100
|
+
private
|
101
101
|
|
102
102
|
def layout_method m
|
103
103
|
m.to_s.gsub(/\Alayout_/, 'handle_').to_sym
|
data/lib/uh/wm/cli.rb
CHANGED
@@ -20,7 +20,7 @@ module Uh
|
|
20
20
|
exit EX_USAGE
|
21
21
|
rescue RuntimeError => e
|
22
22
|
stderr.puts "#{e.class.name}: #{e.message}"
|
23
|
-
stderr.puts e.backtrace.map { |
|
23
|
+
stderr.puts e.backtrace.map { |l| ' %s' % l } if cli.env.debug?
|
24
24
|
exit EX_SOFTWARE
|
25
25
|
end
|
26
26
|
end
|
@@ -34,7 +34,7 @@ module Uh
|
|
34
34
|
|
35
35
|
def parse_arguments!
|
36
36
|
option_parser.parse! @arguments
|
37
|
-
rescue OptionParser::InvalidOption
|
37
|
+
rescue OptionParser::InvalidOption
|
38
38
|
raise ArgumentError, option_parser
|
39
39
|
end
|
40
40
|
|
@@ -42,8 +42,7 @@ module Uh
|
|
42
42
|
Runner.run env
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
private
|
45
|
+
private
|
47
46
|
|
48
47
|
def option_parser
|
49
48
|
OptionParser.new do |opts|
|
@@ -60,7 +59,7 @@ module Uh
|
|
60
59
|
@env.log_logger_level
|
61
60
|
end
|
62
61
|
opts.on '-f', '--run-control PATH',
|
63
|
-
|
62
|
+
'specify alternate run control file' do |e|
|
64
63
|
@env.rc_path = e
|
65
64
|
end
|
66
65
|
opts.on '-r', '--require PATH', 'require ruby feature' do |feature|
|
@@ -71,7 +70,7 @@ module Uh
|
|
71
70
|
@env.layout_class = Object.const_get layout.to_sym
|
72
71
|
end
|
73
72
|
opts.on '-w', Workers.types, '--worker WORKER',
|
74
|
-
|
73
|
+
'specify worker' do |worker|
|
75
74
|
@env.worker = worker.to_sym
|
76
75
|
end
|
77
76
|
|
data/lib/uh/wm/dispatcher.rb
CHANGED
data/lib/uh/wm/launcher.rb
CHANGED
@@ -29,8 +29,7 @@ module Uh
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
private
|
32
|
+
private
|
34
33
|
|
35
34
|
def with_clean_rules
|
36
35
|
original_rules = @rules.dup
|
@@ -40,7 +39,6 @@ module Uh
|
|
40
39
|
@rules.merge! original_rules
|
41
40
|
end
|
42
41
|
|
43
|
-
|
44
42
|
class DSL
|
45
43
|
def initialize actions
|
46
44
|
@actions = actions
|
data/lib/uh/wm/manager.rb
CHANGED
data/lib/uh/wm/run_control.rb
CHANGED
data/lib/uh/wm/runner.rb
CHANGED
@@ -61,7 +61,7 @@ module Uh
|
|
61
61
|
w.on_read { @manager.handle_pending_events }
|
62
62
|
w.on_read_next { @manager.handle_next_event }
|
63
63
|
w.on_timeout do
|
64
|
-
log_debug
|
64
|
+
log_debug 'Worker timeout, ticking...'
|
65
65
|
@events.emit :tick
|
66
66
|
log_debug 'Flushing X output buffer'
|
67
67
|
@manager.flush
|
@@ -80,8 +80,7 @@ module Uh
|
|
80
80
|
manager.disconnect
|
81
81
|
end
|
82
82
|
|
83
|
-
|
84
|
-
private
|
83
|
+
private
|
85
84
|
|
86
85
|
def register_runner_hooks
|
87
86
|
@events.on(:quit) { stop! }
|
@@ -152,35 +151,6 @@ module Uh
|
|
152
151
|
Launcher.launch(self, @env.launch) if @env.launch
|
153
152
|
end
|
154
153
|
end
|
155
|
-
|
156
|
-
|
157
|
-
class XEventLogger
|
158
|
-
include EnvLogging
|
159
|
-
|
160
|
-
def initialize env
|
161
|
-
@env = env
|
162
|
-
end
|
163
|
-
|
164
|
-
def log_event xev
|
165
|
-
complement = case xev.type
|
166
|
-
when :key_press
|
167
|
-
"window: #{xev.window} key: #{xev.key} mask: #{xev.modifier_mask}"
|
168
|
-
when :map_request
|
169
|
-
"window: #{xev.window}"
|
170
|
-
end
|
171
|
-
|
172
|
-
log_debug [
|
173
|
-
'XEvent',
|
174
|
-
xev.type,
|
175
|
-
xev.send_event ? 'SENT' : nil,
|
176
|
-
complement
|
177
|
-
].compact.join ' '
|
178
|
-
end
|
179
|
-
|
180
|
-
def log_xerror req, resource_id, msg
|
181
|
-
log_error "XERROR: #{resource_id} #{req} #{msg}"
|
182
|
-
end
|
183
|
-
end
|
184
154
|
end
|
185
155
|
end
|
186
156
|
end
|
@@ -9,12 +9,14 @@ module Uh
|
|
9
9
|
QUIT_KEYBINDING = 'alt+shift+q'.freeze
|
10
10
|
LOG_READY = 'Working events'.freeze
|
11
11
|
|
12
|
+
attr_reader :other_wm
|
13
|
+
|
12
14
|
def build_regexp pattern, options
|
13
15
|
Regexp.new(pattern, options.each_char.inject(0) do |m, e|
|
14
16
|
m | case e
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
when ?i then Regexp::IGNORECASE
|
18
|
+
when ?m then Regexp::MULTILINE
|
19
|
+
when ?x then Regexp::EXTENDED
|
18
20
|
end
|
19
21
|
end)
|
20
22
|
end
|
@@ -65,7 +67,7 @@ module Uh
|
|
65
67
|
rescue TimeoutError => e
|
66
68
|
raise <<-eoh
|
67
69
|
expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in:
|
68
|
-
```\n#{output.call.lines.map { |
|
70
|
+
```\n#{output.call.lines.map { |l| " #{l}" }.join} ```
|
69
71
|
eoh
|
70
72
|
end
|
71
73
|
|
@@ -79,14 +81,11 @@ expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in:
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def with_other_wm
|
82
|
-
@other_wm = ChildProcess.build('
|
84
|
+
@other_wm = ChildProcess.build('./bin/uhwm')
|
83
85
|
@other_wm.start
|
84
86
|
yield
|
85
87
|
@other_wm.stop
|
86
|
-
|
87
|
-
|
88
|
-
def other_wm
|
89
|
-
@other_wm
|
88
|
+
@other_wm = nil
|
90
89
|
end
|
91
90
|
|
92
91
|
def x_client ident = nil
|
@@ -103,12 +102,6 @@ expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in:
|
|
103
102
|
Integer(`xdpyinfo`[/^focus:\s+window\s+(0x\h+)/, 1])
|
104
103
|
end
|
105
104
|
|
106
|
-
def x_input_event_masks
|
107
|
-
`xdpyinfo`[/current input event mask:\s+0x\h+([\w\s]+):/, 1]
|
108
|
-
.split(/\s+/)
|
109
|
-
.grep /Mask\z/
|
110
|
-
end
|
111
|
-
|
112
105
|
def x_key *k, delay: 12
|
113
106
|
k = k.join " key --delay #{delay} "
|
114
107
|
fail "cannot simulate X key `#{k}'" unless system "xdotool key #{k}"
|
@@ -124,8 +117,7 @@ expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in:
|
|
124
117
|
`xwininfo #{select_args} 2> /dev/null`[/Map State: (\w+)/, 1]
|
125
118
|
end
|
126
119
|
|
127
|
-
|
128
|
-
private
|
120
|
+
private
|
129
121
|
|
130
122
|
def timeout_until message = 'condition not met after %d seconds'
|
131
123
|
timeout = ENV.key?('UHWMTEST_TIMEOUT') ?
|
@@ -141,7 +133,6 @@ expected `#{message}' (#{times}) not seen after #{e.timeout} seconds in:
|
|
141
133
|
raise TimeoutError.new(message % timeout, timeout)
|
142
134
|
end
|
143
135
|
|
144
|
-
|
145
136
|
class TimeoutError < ::StandardError
|
146
137
|
attr_reader :timeout
|
147
138
|
|
@@ -9,7 +9,7 @@ module Uh
|
|
9
9
|
def initialize name = object_id
|
10
10
|
@name = "#{self.class.name.split('::').last}/#{name}"
|
11
11
|
@geo = Geo.new(0, 0, 640, 480)
|
12
|
-
@display = Display.new.
|
12
|
+
@display = Display.new.open
|
13
13
|
end
|
14
14
|
|
15
15
|
def terminate
|
@@ -42,8 +42,7 @@ module Uh
|
|
42
42
|
window.wclass = [wclass] * 2
|
43
43
|
end
|
44
44
|
|
45
|
-
def map
|
46
|
-
times.times { window.map }
|
45
|
+
def map
|
47
46
|
window.map
|
48
47
|
self
|
49
48
|
end
|
data/lib/uh/wm/version.rb
CHANGED
data/lib/uh/wm/workers/base.rb
CHANGED
data/lib/uh/wm/workers/kqueue.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Uh
|
2
|
+
module WM
|
3
|
+
class XEventLogger
|
4
|
+
include EnvLogging
|
5
|
+
|
6
|
+
def initialize env
|
7
|
+
@env = env
|
8
|
+
end
|
9
|
+
|
10
|
+
def log_event xev
|
11
|
+
complement = case xev.type
|
12
|
+
when :key_press
|
13
|
+
"window: #{xev.window} key: #{xev.key} mask: #{xev.modifier_mask}"
|
14
|
+
when :map_request
|
15
|
+
"window: #{xev.window}"
|
16
|
+
end
|
17
|
+
|
18
|
+
log_debug [
|
19
|
+
'XEvent',
|
20
|
+
xev.type,
|
21
|
+
xev.send_event ? 'SENT' : nil,
|
22
|
+
complement
|
23
|
+
].compact.join ' '
|
24
|
+
end
|
25
|
+
|
26
|
+
def log_xerror req, resource_id, msg
|
27
|
+
log_error "XERROR: #{resource_id} #{req} #{msg}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uh-wm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-kqueue
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.2.4
|
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
26
|
version: 0.2.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: uh
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: uh-layout
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.4.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.4.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: aruba
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.7.4
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.7.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/uh/wm/workers/blocking.rb
|
143
143
|
- lib/uh/wm/workers/kqueue.rb
|
144
144
|
- lib/uh/wm/workers/mux.rb
|
145
|
+
- lib/uh/wm/x_event_logger.rb
|
145
146
|
homepage: https://rubygems.org/gems/uh-wm
|
146
147
|
licenses:
|
147
148
|
- BSD-3-Clause
|
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
163
|
version: '0'
|
163
164
|
requirements: []
|
164
165
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.6.14
|
166
167
|
signing_key:
|
167
168
|
specification_version: 4
|
168
169
|
summary: minimalistic tiling and stacking X window manager
|