Class: 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

public initialize(aAreaId, aView = View.curr)
aView:the view which contains this area.
[View source]


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

==, current?

Public Instance Methods Included from Rumai::Chain

next, prev

Public Instance Methods Included from Rumai::ClientContainer

clients, grouping

Public Class Method Details

curr

public curr

Returns the currently focused area.

[View source]


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

public chain
[View source]


376
377
378
# File 'lib/rumai/wm.rb', line 376

def chain
  @view.areas
end

client_ids

public client_ids

Returns the IDs of the clients in this area.

[View source]


387
388
389
# File 'lib/rumai/wm.rb', line 387

def client_ids
  @view.client_ids @id
end

column?

public column?

Checks if this area is a column in the managed area.

[View source]


365
366
367
# File 'lib/rumai/wm.rb', line 365

def column?
  not float?
end

concat

public concat(aArea)

Concatenates the given area to the bottom of this area.

[View source]


461
462
463
# File 'lib/rumai/wm.rb', line 461

def concat aArea
  push aArea.clients
end

each

public each(&aBlock)

Iterates through each client in this container.

[View source]


393
394
395
# File 'lib/rumai/wm.rb', line 393

def each &aBlock
  clients.each(&aBlock)
end

exist?

public exist?

Checks if this object exists in the chain.

[View source]


381
382
383
# File 'lib/rumai/wm.rb', line 381

def exist?
  chain.include? self
end

float?

public float?

Checks if this area is the floating area.

[View source]


360
361
362
# File 'lib/rumai/wm.rb', line 360

def float?
  @id == '~'
end

focus

public focus

WM operations

Puts focus on this area.

[View source]


409
410
411
# File 'lib/rumai/wm.rb', line 409

def focus
  @view.ctl.write "select #{@id}"
end

insert

public insert(*aClients)

Inserts the given clients after the currently focused client in this area.

[View source]


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

public layout

Sets the layout of clients in this column.

[View source]


398
399
400
# File 'lib/rumai/wm.rb', line 398

def layout= aMode
  @view.ctl.write "colmode #{@id} #{aMode}"
end

length

public 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.

[View source]


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

public push(*aClients)

Also known as: <<

Inserts the given clients at the bottom of this area.

[View source]


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

public unshift(*aClients)

Inserts the given clients at the top of this area.

[View source]


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