Class: VER::ToplevelLayout

Inherits:
Tk::Frame
  • Object
show all
Defined in:
lib/ver/layout/toplevel.rb

Overview

A layout that puts every Buffer into its own Tk::Toplevel. This means that the buffers can be managed by the window-manager itself instead of VER, which might be preferable for people using tiling wms.

So far this only has been used inside awesome, feedback on other wms are welcome.

Defined Under Namespace

Classes: Toplevel

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ToplevelLayout

Returns a new instance of ToplevelLayout.



42
43
44
45
46
# File 'lib/ver/layout/toplevel.rb', line 42

def initialize(*args)
  super
  configure takefocus: false
  VER.root.wm_withdraw
end

Instance Method Details

#add_buffer(buffer) ⇒ Object



48
49
50
# File 'lib/ver/layout/toplevel.rb', line 48

def add_buffer(buffer)
  buffer.layout.show
end

#close_buffer(buffer) ⇒ Object



64
65
66
# File 'lib/ver/layout/toplevel.rb', line 64

def close_buffer(buffer)
  buffer.layout.close
end

#create_buffer(options = {}) {|buffer| ... } ⇒ Object

Yields:

  • (buffer)


56
57
58
59
60
61
62
# File 'lib/ver/layout/toplevel.rb', line 56

def create_buffer(options = {})
  toplevel = Toplevel.new(self, takefocus: false)
  buffer = Buffer.new(toplevel, options)
  toplevel.buffer = buffer
  yield buffer if block_given?
  buffer
end

#forget_buffer(buffer) ⇒ Object



52
53
54
# File 'lib/ver/layout/toplevel.rb', line 52

def forget_buffer(buffer)
  buffer.layout.hide
end