Class: Rumai::Area
- Object
- Rumai::Area
Included Modules
Rumai::WidgetImpl, Rumai::Chain, Rumai::ClientContainer, Enumerable
A region that contains clients. This can be either the floating area or a column in the managed area.
Attributes
Instance Attributes
view | [RW] | public |
Returns the value of attribute view. |
---|
Constructor Summary
aView: | the view which contains this area. |
354 355 356 357 |
# File 'lib/rumai/wm.rb', line 354 def initialize aAreaId, aView = View.curr @id = Integer(aAreaId) rescue aAreaId @view = aView end |
Public Visibility
Public Class Method Summary
curr |
Returns the currently focused area. |
---|
Public Instance Method Summary
#chain | |
---|---|
#client_ids |
Returns the IDs of the clients in this area. |
#column? |
Checks if this area is a column in the managed area. |
#concat(aArea) |
Concatenates the given area to the bottom of this area. |
#each(&aBlock) |
Iterates through each client in this container. |
#exist? |
Checks if this object exists in the chain. |
#float? |
Checks if this area is the floating area. |
#focus |
WM operations. |
#insert(*aClients) |
Inserts the given clients after the currently focused client in this area. |
#layout |
Sets the layout of clients in this column. |
#length |
Ensures that this area has at most the given number of clients. |
#push(*aClients) #<< |
Inserts the given clients at the bottom of this area. |
#unshift(*aClients) |
Inserts the given clients at the top of this area. |
Public Instance Methods Included from Rumai::WidgetImpl
Public Instance Methods Included from Rumai::Chain
Public Instance Methods Included from Rumai::ClientContainer
Public Class Method Details
curr
Returns the currently focused area.
371 372 373 |
# File 'lib/rumai/wm.rb', line 371 def self.curr View.curr.area_of_client Client.curr end |
Public Instance Method Details
chain
376 377 378 |
# File 'lib/rumai/wm.rb', line 376 def chain @view.areas end |
client_ids
Returns the IDs of the clients in this area.
387 388 389 |
# File 'lib/rumai/wm.rb', line 387 def client_ids @view.client_ids @id end |
column?
Checks if this area is a column in the managed area.
365 366 367 |
# File 'lib/rumai/wm.rb', line 365 def column? not float? end |
concat
Concatenates the given area to the bottom of this area.
461 462 463 |
# File 'lib/rumai/wm.rb', line 461 def concat aArea push aArea.clients end |
each
Iterates through each client in this container.
393 394 395 |
# File 'lib/rumai/wm.rb', line 393 def each &aBlock clients.each(&aBlock) end |
exist?
Checks if this object exists in the chain.
381 382 383 |
# File 'lib/rumai/wm.rb', line 381 def exist? chain.include? self end |
float?
Checks if this area is the floating area.
360 361 362 |
# File 'lib/rumai/wm.rb', line 360 def float? @id == '~' end |
focus
WM operations
Puts focus on this area.
409 410 411 |
# File 'lib/rumai/wm.rb', line 409 def focus @view.ctl.write "select #{@id}" end |
insert
Inserts the given clients after the currently focused client in this area.
436 437 438 439 440 441 442 443 |
# File 'lib/rumai/wm.rb', line 436 def insert *aClients aClients.flatten! return if aClients.empty? aClients.each do |c| import_client c end end |
layout
Sets the layout of clients in this column.
398 399 400 |
# File 'lib/rumai/wm.rb', line 398 def layout= aMode @view.ctl.write "colmode #{@id} #{aMode}" end |
length
Ensures that this area has at most the given number of clients. Areas to the right of this one serve as a buffer into which excess clients are evicted and from which deficit clients are imported.
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/rumai/wm.rb', line 468 def length= aMaxClients return unless aMaxClients > 0 len, out = length, fringe if len > aMaxClients out.unshift clients[aMaxClients..-1].reverse elsif len < aMaxClients until (diff = aMaxClients - length) == 0 immigrants = out.clients.first(diff) break if immigrants.empty? push immigrants end end end |
push
Also known as: <<
Inserts the given clients at the bottom of this area.
425 426 427 428 429 430 431 |
# File 'lib/rumai/wm.rb', line 425 def push *aClients if target = clients.last target.focus end insert aClients end |
unshift
Inserts the given clients at the top of this area.
446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/rumai/wm.rb', line 446 def unshift *aClients aClients.flatten! return if aClients.empty? if target = clients.first target.focus end aClients.each do |c| import_client c c.send :up if target end end |