Class: Automux::Core::Tmux::Window

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Includes:
Support::HooksHelper, Support::OptionsHelper
Defined in:
lib/automux/core/tmux/window.rb

Defined Under Namespace

Classes: Data

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::HooksHelper

#post_hooks, #pre_hooks

Methods included from Support::CustomAccessors

#dup_attr_reader

Constructor Details

#initialize(session, window_data) ⇒ Window

Returns a new instance of Window.



14
15
16
17
18
19
20
21
# File 'lib/automux/core/tmux/window.rb', line 14

def initialize(session, window_data)
  @session = session
  @hooks = []
  @options = []
  @panes = []
  @data = Data.new(window_data)
  @index = @data.index
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



9
10
11
# File 'lib/automux/core/tmux/window.rb', line 9

def data
  @data
end

#indexObject (readonly)

Returns the value of attribute index.



9
10
11
# File 'lib/automux/core/tmux/window.rb', line 9

def index
  @index
end

#sessionObject (readonly)

Returns the value of attribute session.



9
10
11
# File 'lib/automux/core/tmux/window.rb', line 9

def session
  @session
end

Instance Method Details

#change_root_commandObject



53
54
55
# File 'lib/automux/core/tmux/window.rb', line 53

def change_root_command
  %[cd #{ root }]
end

#get_bindingObject



69
70
71
# File 'lib/automux/core/tmux/window.rb', line 69

def get_binding
  binding
end

#has_panes?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/automux/core/tmux/window.rb', line 43

def has_panes?
  !@panes.nil?
end

#opted_in?Boolean

Returns:

  • (Boolean)


47
48
49
50
51
# File 'lib/automux/core/tmux/window.rb', line 47

def opted_in?
  return true unless is_optional?

  data.opt
end

#set_option(option) ⇒ Object



39
40
41
# File 'lib/automux/core/tmux/window.rb', line 39

def set_option(option)
  %[tmux set-window-option -t #{ session.name }:#{ index } #{ option.name } '#{ option.value }']
end

#setupObject



63
64
65
66
67
# File 'lib/automux/core/tmux/window.rb', line 63

def setup
  setup_options
  setup_panes
  setup_hooks
end

#update_indexObject

:stopdoc:



59
60
61
# File 'lib/automux/core/tmux/window.rb', line 59

def update_index
  @index ||= session.next_available_window_index
end