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

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

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, data) ⇒ Window

Returns a new instance of Window.



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

def initialize(session, data)
  @session = session
  @data = data
  @opt = data['opt']
  @index = data['index']
  @root = data['root']
  @data_hooks = data['hooks'] || []
  @hooks = []
  @data_options = data['options'] || []
  @options = []
  @panes = []
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



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

def index
  @index
end

#rootObject (readonly)

Returns the value of attribute root.



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

def root
  @root
end

Instance Method Details

#change_root_commandObject



57
58
59
# File 'lib/automux/core/tmux/window.rb', line 57

def change_root_command
  %[cd #{ root }]
end

#get_bindingObject



61
62
63
# File 'lib/automux/core/tmux/window.rb', line 61

def get_binding
  binding
end

#has_panes?Boolean

Returns:

  • (Boolean)


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

def has_panes?
  !@panes.nil?
end

#layoutObject



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

def layout
  data['layout']
end

#nameObject



29
30
31
# File 'lib/automux/core/tmux/window.rb', line 29

def name
  data['name']
end

#opted_in?Boolean

Returns:

  • (Boolean)


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

def opted_in?
  return true if @opt.nil?

  @opt
end

#set_option(option) ⇒ Object



25
26
27
# File 'lib/automux/core/tmux/window.rb', line 25

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

#setupObject



33
34
35
36
37
# File 'lib/automux/core/tmux/window.rb', line 33

def setup
  setup_options
  setup_panes
  setup_hooks
end

#update_indexObject



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

def update_index
  @index ||= session.next_available_window_index
end