Parent

Teamocil::Layout::Window

This class represents a window within tmux

Attributes

filters[R]
index[R]
name[R]
options[R]
root[R]
splits[R]

Public Class Methods

new(session, index, attrs={}) click to toggle source

Initialize a new tmux window

@param session [Session] the session where the window is initialized @param index [Fixnnum] the window index @param attrs [Hash] the window data from the layout file

# File lib/teamocil/layout/window.rb, line 13
def initialize(session, index, attrs={}) # {{{
  @name = attrs["name"]
  @root = attrs["root"]
  @options = attrs["options"] || {}

  @splits = attrs["splits"] || []
  @splits = @splits.each_with_index.map { |split, split_index| Split.new(self, split_index, split) }

  @filters = attrs["filters"] || {}
  @filters["before"] ||= []
  @filters["after"] ||= []

  @index = index
  @session = session
end

Public Instance Methods

generate_commands() click to toggle source

Generate commands to send to tmux

@return [Array]

# File lib/teamocil/layout/window.rb, line 32
def generate_commands # {{{
  commands = []

  if @session.options.include?(:here) and @index == 0
    commands << "tmux rename-window \"#{@name}\""
  else
    commands << "tmux new-window -n \"#{@name}\""
  end

  commands << @splits.map(&:generate_commands)

  @options.each_pair do |option, value|
    value = "on"  if value === true
    value = "off" if value === false
    commands << "tmux set-window-option #{option} #{value}"
  end

  commands
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.