uh-wm 0.0.7 → 0.0.8

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: a3607acc6f3a156a4fe6ecfdd4c960daecdde3bc
4
- data.tar.gz: 9aac8a32b1d1619e055e0c5af14e28d8033dfe9f
3
+ metadata.gz: a9e65ddc3d9f3e3f406b624138ef47c86531380e
4
+ data.tar.gz: 095aac6361586080213412cb40d1ba6a7393150a
5
5
  SHA512:
6
- metadata.gz: f332e7a7d0b81b91d356f7e6345f073eb551d0ea6cabe361285df90c62a14b3cecb29c32f339b5fb032d47c343135b7bb676fb026111ef66463bd38f548a504e
7
- data.tar.gz: 2e0fbe32e68ef89136a64045f55180fcf3211bd9dc1a4b6dfba461356e3a8076be7d64dcbb989fcacd07d4058dd756c6748315a484c0376d1cacbf304b134a98
6
+ metadata.gz: 3d3733270d72b481d05fded4c6bd0a66dcbdce5be277c639a6aba35ef613128276251f1795d70aa876ec375f85e7adc9d9da5ccf6a40576b6ff1aa1d38fa69da
7
+ data.tar.gz: ec55836544feb58833aae7168adc823640a1dc5d27531a3d1af2b6d71442f6847b7aba9fc4906b78f06382eb178ee65a891813c14b9c267386953701d2478c8b
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
- uh-wm
2
- =====
1
+ uhwm
2
+ ====
3
3
 
4
4
  [![Version ][badge-version-img]][badge-version-uri]
5
5
  [![Build status ][badge-build-img]][badge-build-uri]
6
6
  [![Code Climate ][badge-cclimate-img]][badge-cclimate-uri]
7
7
 
8
8
 
9
- uh-wm is a minimalistic tiling and stacking window manager for X. It
9
+ uhwm is a minimalistic tiling and stacking window manager for X. It
10
10
  shares some similarities with dwm and wmii, but is written in ruby so
11
11
  you can configure and extend features directly with ruby code.
12
12
 
13
13
  The layout strategy is interchangeable, the default one being the
14
14
  `uh-layout` ruby gem. A layout is a simple ruby object responding to
15
- specific messages.
15
+ specific messages, so it's easy to write your own layout.
16
16
 
17
17
  Main features:
18
18
 
@@ -31,17 +31,19 @@ specific messages.
31
31
  * very limited ICCCM support.
32
32
 
33
33
 
34
- Getting started
35
- ---------------
34
+ Installation
35
+ ------------
36
36
 
37
- ### Installation (requires ruby ~> 2.1 with rubygems)
37
+ uhwm requires ruby ~> 2.1 with rubygems, and is currently
38
+ distributed as the `uh-wm` ruby gem.
38
39
 
39
40
  ```
40
41
  $ gem install uh-wm
41
42
  ```
42
43
 
43
44
 
44
- ### Usage
45
+ Usage
46
+ -----
45
47
 
46
48
  ```
47
49
  Usage: uhwm [options]
@@ -59,6 +61,69 @@ options:
59
61
  ```
60
62
 
61
63
 
64
+ Configuration
65
+ -------------
66
+
67
+ uhwm can be configured with a run control file, written in ruby. A
68
+ simple example is provided below, more details will be available in
69
+ the [`RunControl` class documentation][run_control_doc].
70
+
71
+ ``` ruby
72
+ DMENU = 'dmenu_run -b'.freeze
73
+ VT = 'urxvt'.freeze
74
+ BROWSERS = %w[
75
+ arora chromium firebird firefox galeon iceweasel konqueror pentadactyl
76
+ phoenix vimperator
77
+ ].freeze
78
+
79
+
80
+ modifier :mod1 # This key will be added to the modifier mask for
81
+ # *all* key bindings.
82
+ key(:p) { execute DMENU } # Execute given command in a shell when mod1+shift
83
+ # is pressed.
84
+ key(:Q) { quit } # Quit when mod1+shift+q is pressed (a capitalized
85
+ # key adds shift to mod mask).
86
+ key(:enter) { execute VT } # Common key names (`enter') are translated to
87
+ # their X equivalent (`return').
88
+
89
+ rule BROWSERS do # Move windows to the `www' view when their app
90
+ layout_view_set 'www' # class matches either /\Aarora/, /\Achromium/… etc
91
+ end
92
+
93
+ launch do # Execute urxvt program twice, synchronously.
94
+ execute! VT # `execute!' is a variant of `execute' which
95
+ execute! VT # will only return when a window is mapped.
96
+ layout_client_column_set :succ # Move last mapped window to next column.
97
+ end
98
+ ```
99
+
100
+ Blocks given to `key`, `rule`, `launch` are executed in a special
101
+ context providing access to methods named "actions", which are
102
+ described in next section.
103
+
104
+ [run_control_doc]: http://www.rubydoc.info/gems/uh-wm/Uh/WM/RunControl
105
+
106
+
107
+ Actions
108
+ -------
109
+
110
+ The actions DSL implements a few built-in messages, but also acts as
111
+ a proxy to the layout. Any message prefixed with `layout_` will be
112
+ forwarded to the layout, with the prefix stripped. That is, if
113
+ `layout_view_sel '2'` is evaluated, then the layout will receive the
114
+ `view_sel` message with `"2"` as argument. Up to date information is
115
+ available in the [`ActionsHandler` class documentation][actions_doc]
116
+
117
+ | Message | Arguments | Description
118
+ | ------------- | --------- | -----------------------------------
119
+ | quit | | requests uhwm to terminate
120
+ | execute | command | executes given `command` in a shell
121
+ | kill_current | | kills layout current client
122
+ | layout\_\* | \*\_ | forwards messages to layout
123
+
124
+ [actions_doc]: http://www.rubydoc.info/gems/uh-wm/Uh/WM/ActionsHandler
125
+
126
+
62
127
 
63
128
  [badge-version-img]: https://img.shields.io/gem/v/uh-wm.svg?style=flat-square
64
129
  [badge-version-uri]: https://rubygems.org/gems/uh-wm
data/lib/uh/wm/cli.rb CHANGED
@@ -81,7 +81,7 @@ module Uh
81
81
  exit
82
82
  end
83
83
  opts.on_tail '-V', '--version', 'print version' do
84
- @env.puts VERSION
84
+ @env.puts WM::VERSION
85
85
  exit
86
86
  end
87
87
  end
data/lib/uh/wm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Uh
2
2
  module WM
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
@@ -0,0 +1,31 @@
1
+ module Uh
2
+ module WM
3
+ module Workers
4
+ class KQueue < Base
5
+ TIMEOUT_DEFAULT = 1
6
+
7
+ def initialize timeout: TIMEOUT_DEFAULT
8
+ super
9
+ @queue = ::KQueue::Queue.new
10
+ end
11
+
12
+ def watch io
13
+ @queue.watch_stream_for_read io.to_io do
14
+ @on_read.call
15
+ end
16
+ end
17
+
18
+ def on_timeout &block
19
+ ::KQueue::Watcher.new(@queue, 1, :timer, [], 1000, proc do |event|
20
+ block.call
21
+ end)
22
+ end
23
+
24
+ def work_events
25
+ @before_watch.call if @before_watch
26
+ events = @queue.process
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/uh/wm/workers.rb CHANGED
@@ -3,6 +3,7 @@ module Uh
3
3
  module Workers
4
4
  FACTORIES = {
5
5
  block: ->(options) { Blocking.new(options) },
6
+ kqueue: ->(options) { KQueue.new(options) },
6
7
  mux: ->(options) { Mux.new(options) }
7
8
  }.freeze
8
9
 
data/lib/uh/wm.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'forwardable'
2
2
  require 'logger'
3
3
  require 'optparse'
4
+ require 'rb-kqueue'
4
5
  require 'uh'
5
6
 
6
7
  require 'uh/wm/env_logging'
@@ -15,9 +16,11 @@ require 'uh/wm/logger_formatter'
15
16
  require 'uh/wm/manager'
16
17
  require 'uh/wm/run_control'
17
18
  require 'uh/wm/runner'
19
+ require 'uh/wm/version'
18
20
  require 'uh/wm/workers'
19
21
  require 'uh/wm/workers/base'
20
22
  require 'uh/wm/workers/blocking'
23
+ require 'uh/wm/workers/kqueue'
21
24
  require 'uh/wm/workers/mux'
22
25
 
23
26
  module Uh
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uh-wm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-05-20 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rb-kqueue
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.4
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: uh
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +150,7 @@ files:
136
150
  - lib/uh/wm/workers.rb
137
151
  - lib/uh/wm/workers/base.rb
138
152
  - lib/uh/wm/workers/blocking.rb
153
+ - lib/uh/wm/workers/kqueue.rb
139
154
  - lib/uh/wm/workers/mux.rb
140
155
  homepage: https://rubygems.org/gems/uh-wm
141
156
  licenses:
@@ -162,3 +177,4 @@ signing_key:
162
177
  specification_version: 4
163
178
  summary: minimalistic tiling and stacking window manager for X
164
179
  test_files: []
180
+ has_rdoc: