Class: Uh::WM::Manager
- Inherits:
-
Object
- Object
- Uh::WM::Manager
- Defined in:
- lib/uh/wm/manager.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
Instance Method Summary collapse
- #configure(window) ⇒ Object
- #destroy(window) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #map(window) ⇒ Object
- #on_change(&block) ⇒ Object
- #on_configure(&block) ⇒ Object
- #on_manage(&block) ⇒ Object
- #on_unmanage(&block) ⇒ Object
- #to_s ⇒ Object
- #unmap(window) ⇒ Object
- #update_properties(window) ⇒ Object
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
8 9 10 |
# File 'lib/uh/wm/manager.rb', line 8 def initialize @clients = [] end |
Instance Attribute Details
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
6 7 8 |
# File 'lib/uh/wm/manager.rb', line 6 def clients @clients end |
Instance Method Details
#configure(window) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/uh/wm/manager.rb', line 32 def configure(window) if client = client_for(window) client.configure else geo = @on_configure ? @on_configure.call(window) : DEFAULT_GEO window.configure_event geo end end |
#destroy(window) ⇒ Object
55 56 57 58 |
# File 'lib/uh/wm/manager.rb', line 55 def destroy(window) return unless client = client_for(window) unmanage client end |
#map(window) ⇒ Object
41 42 43 44 |
# File 'lib/uh/wm/manager.rb', line 41 def map(window) return if window.override_redirect? || client_for(window) Client.new(window).tap { |o| manage o } end |
#on_change(&block) ⇒ Object
28 29 30 |
# File 'lib/uh/wm/manager.rb', line 28 def on_change(&block) @on_change = block end |
#on_configure(&block) ⇒ Object
16 17 18 |
# File 'lib/uh/wm/manager.rb', line 16 def on_configure(&block) @on_configure = block end |
#on_manage(&block) ⇒ Object
20 21 22 |
# File 'lib/uh/wm/manager.rb', line 20 def on_manage(&block) @on_manage = block end |
#on_unmanage(&block) ⇒ Object
24 25 26 |
# File 'lib/uh/wm/manager.rb', line 24 def on_unmanage(&block) @on_unmanage = block end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/uh/wm/manager.rb', line 12 def to_s @clients.join $/ end |
#unmap(window) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/uh/wm/manager.rb', line 46 def unmap(window) return unless client = client_for(window) if client.unmap_count > 0 client.unmap_count -= 1 else unmanage client end end |
#update_properties(window) ⇒ Object
60 61 62 63 64 |
# File 'lib/uh/wm/manager.rb', line 60 def update_properties(window) return unless client = client_for(window) client.update_window_properties @on_change.call client if @on_change end |