uh-wm 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afe14a18b77ca68f10d03fabbbc634a2ec9e3e4c
4
- data.tar.gz: 76fa551b050eeb4a1c1f8210139a680450788a4a
3
+ metadata.gz: d30b881b7363a539a259011ee767eb42b941fe65
4
+ data.tar.gz: 4ae10cdb8a3d9a1da9b9ec4c55bf1c88890a6897
5
5
  SHA512:
6
- metadata.gz: deb8569d3d342d0bf77a46e17b32af1f28be149c3fe023e87e7ba866262d88a47b3f05761077cbf0e7d693e57ad0fb526c4e60fa4c76af3d081c23648b56ce9d
7
- data.tar.gz: f13232ba3b1292aac1b4589390068443732f9dcb0c61174323f10400a03347831075d2d36f3b1c9b90ba36f1144ac3f92d67b813f40ef1f1ccc94587e9510188
6
+ metadata.gz: 0bdbddabd4ed09e97349bd80ed38b011aa33a816a8feab4b3e5cf9f417500921e1ffe943df8697217cef4d3d4d00450ae91d370abda2ed60060048bf749bc0fd
7
+ data.tar.gz: af6bc893f76cc828b33dc78bd02ed6f182ee580dc375653cc206810892380b370c75c65d81017800d2b768cec82c2e9126c2328283b82dc67c7cdc9601c89c90
data/README.md CHANGED
@@ -26,6 +26,7 @@ specific messages, so it's easy to write your own layout.
26
26
  * external program execution;
27
27
  * no re-parenting (therefore, no window decoration either);
28
28
  * no grabbing of the modifier key alone;
29
+ * no default key binding except for exiting;
29
30
  * no mouse event handling;
30
31
  * no EWMH support;
31
32
  * very limited ICCCM support.
@@ -37,8 +38,8 @@ Installation
37
38
  uhwm requires ruby ~> 2.1 with rubygems, and is currently
38
39
  distributed as the `uh-wm` ruby gem.
39
40
 
40
- ```
41
- $ gem install uh-wm
41
+ ``` shell
42
+ gem install uh-wm # install the gem or update to last release
42
43
  ```
43
44
 
44
45
 
@@ -66,7 +67,12 @@ Configuration
66
67
 
67
68
  uhwm can be configured with a run control file written in ruby. A
68
69
  simple example is provided below, more details are available in the
69
- [`RunControl` class documentation][run_control_doc].
70
+ [`RunControl` class documentation][run_control_doc]. The file must be
71
+ located at the `~/.uhwmrc.rb` path.
72
+
73
+ Please note that uhwm ships with only one key binding: `mod+shift+q`
74
+ which is bound to the `quit` action. You *need* to write your own
75
+ configuration file if you want to do something useful with uhwm.
70
76
 
71
77
  ``` ruby
72
78
  DMENU = 'dmenu_run -b'
@@ -127,6 +133,23 @@ available in the [`ActionsHandler` class documentation][actions_doc]
127
133
  Hacking uhwm
128
134
  ------------
129
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
+
130
153
  ### Installation with bundler
131
154
 
132
155
  ``` shell
@@ -144,7 +167,8 @@ rake spec # Run unit test suite
144
167
  rspec # Run unit test suite
145
168
  ```
146
169
 
147
- Prefix the commands as `bundle exec COMMAND` to use bundler.
170
+ Prefix the commands as `bundle exec COMMAND` if you're using
171
+ bundler.
148
172
 
149
173
  ### Running uhwm within a nested X session
150
174
 
@@ -377,6 +401,11 @@ key :m do
377
401
  end
378
402
  end
379
403
  ```
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=lib` for example).
380
409
 
381
410
 
382
411
 
@@ -22,17 +22,19 @@ module Uh
22
22
  def_delegators :@output, :print, :puts
23
23
 
24
24
  attr_reader :output, :keybinds
25
- attr_accessor :verbose, :debug, :rc_path, :modifier, :worker,
26
- :layout, :layout_class, :layout_options, :rules, :launch
25
+ attr_accessor :verbose, :debug, :rc_path, :modifier, :modifier_ignore,
26
+ :worker, :layout, :layout_class, :layout_options, :rules,
27
+ :launch
27
28
 
28
29
  def initialize output
29
- @output = output
30
- @rc_path = RC_PATH
31
- @modifier = MODIFIER
32
- @keybinds = KEYBINDS.dup
33
- @layout_options = {}
34
- @worker = :block
35
- @rules = {}
30
+ @output = output
31
+ @rc_path = RC_PATH
32
+ @modifier = MODIFIER
33
+ @modifier_ignore = []
34
+ @keybinds = KEYBINDS.dup
35
+ @layout_options = {}
36
+ @worker = WORKER
37
+ @rules = {}
36
38
  end
37
39
 
38
40
  def verbose?
@@ -8,13 +8,14 @@ module Uh
8
8
  Events::STRUCTURE_NOTIFY_MASK
9
9
  DEFAULT_GEO = Geo.new(0, 0, 320, 240).freeze
10
10
 
11
- attr_reader :modifier, :display, :clients
11
+ attr_reader :modifier, :modifier_ignore, :display, :clients
12
12
 
13
- def initialize events, modifier, display = Display.new
14
- @events = events
15
- @modifier = modifier
16
- @display = display
17
- @clients = []
13
+ def initialize events, mod, mod_ignore = [], display = Display.new
14
+ @events = events
15
+ @modifier = mod
16
+ @modifier_ignore = mod_ignore
17
+ @display = display
18
+ @clients = []
18
19
  end
19
20
 
20
21
  def to_io
@@ -43,7 +44,9 @@ module Uh
43
44
  def grab_key keysym, mod = nil
44
45
  mod_mask = KEY_MODIFIERS[@modifier]
45
46
  mod_mask |= KEY_MODIFIERS[mod] if mod
46
- @display.grab_key keysym.to_s, mod_mask
47
+ combine_modifier_masks(@modifier_ignore) do |ignore_mask|
48
+ @display.grab_key keysym.to_s, mod_mask | ignore_mask
49
+ end
47
50
  end
48
51
 
49
52
  def configure window
@@ -104,10 +107,12 @@ module Uh
104
107
  end
105
108
 
106
109
  def handle_key_press event
107
- key_selector = event.modifier_mask & KEY_MODIFIERS[:shift] == 1 ?
108
- [event.key.to_sym, :shift] :
109
- event.key.to_sym
110
- @events.emit :key, *key_selector
110
+ case remove_modifier_masks event.modifier_mask, @modifier_ignore
111
+ when KEY_MODIFIERS[@modifier]
112
+ @events.emit :key, event.key.to_sym
113
+ when KEY_MODIFIERS[@modifier] | KEY_MODIFIERS[:shift]
114
+ @events.emit :key, event.key.to_sym, :shift
115
+ end
111
116
  end
112
117
 
113
118
  def handle_configure_request event
@@ -148,6 +153,21 @@ module Uh
148
153
  @display.listen_events INPUT_MASK
149
154
  @display.sync false
150
155
  end
156
+
157
+ def combine_modifier_masks mods
158
+ yield 0
159
+ (1..mods.size).flat_map { |n| mods.combination(n).to_a }.each do |cmb|
160
+ yield cmb.map { |e| KEY_MODIFIERS[e] }.inject &:|
161
+ end
162
+ end
163
+
164
+ def remove_modifier_masks mask, remove
165
+ return mask unless remove.any?
166
+ mask & ~(@modifier_ignore
167
+ .map { |e| KEY_MODIFIERS[e] }
168
+ .inject &:|
169
+ )
170
+ end
151
171
  end
152
172
  end
153
173
  end
@@ -90,12 +90,13 @@ module Uh
90
90
  end
91
91
  end
92
92
 
93
- # Defines the modifier key to use for key bindings
93
+ # Defines the modifier masks to use for key bindings
94
94
  # @example
95
95
  # modifier :mod1 # Use `mod1' as modifier
96
96
  # @param keysym [Symbol] X key sym
97
- def modifier keysym
98
- @env.modifier = keysym
97
+ def modifier keysym, ignore: []
98
+ @env.modifier = keysym
99
+ @env.modifier_ignore = [*ignore]
99
100
  end
100
101
 
101
102
  # Declares a client rule
@@ -37,7 +37,7 @@ module Uh
37
37
  end
38
38
 
39
39
  def manager
40
- @manager ||= Manager.new(@events, @env.modifier)
40
+ @manager ||= Manager.new(@events, @env.modifier, @env.modifier_ignore)
41
41
  end
42
42
 
43
43
  def evaluate_run_control
@@ -0,0 +1,24 @@
1
+ require 'childprocess'
2
+
3
+ module Uh
4
+ module WM
5
+ module Testing
6
+ module Headless
7
+ DISPLAY_NAME = ':42'
8
+ DISPLAY_SCREEN = '640x480x24'
9
+
10
+ def with_xvfb
11
+ xvfb = ChildProcess.build(*%W[
12
+ Xvfb -ac #{DISPLAY_NAME} -screen 0 #{DISPLAY_SCREEN}
13
+ ])
14
+ xvfb.start
15
+ original_display = ENV['DISPLAY']
16
+ ENV['DISPLAY'] = DISPLAY_NAME
17
+ yield
18
+ ENV['DISPLAY'] = original_display
19
+ xvfb.stop
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Uh
2
2
  module WM
3
- VERSION = '0.0.13'
3
+ VERSION = '0.0.14'
4
4
  end
5
5
  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.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-kqueue
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
- - !ruby/object:Gem::Dependency
84
- name: headless
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rake
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +134,7 @@ files:
148
134
  - lib/uh/wm/run_control.rb
149
135
  - lib/uh/wm/runner.rb
150
136
  - lib/uh/wm/testing/acceptance_helpers.rb
137
+ - lib/uh/wm/testing/headless.rb
151
138
  - lib/uh/wm/testing/x_client.rb
152
139
  - lib/uh/wm/version.rb
153
140
  - lib/uh/wm/workers.rb