Class: Teamocil::Tmux::Pane

Inherits:
Object
  • Object
show all
Defined in:
lib/teamocil/tmux/pane.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pane_base_indexObject



17
18
19
# File 'lib/teamocil/tmux/pane.rb', line 17

def self.pane_base_index
  @pane_base_index ||= Teamocil::Tmux.window_option('pane-base-index', default: 0)
end

Instance Method Details

#as_tmuxObject



4
5
6
7
8
9
10
11
# File 'lib/teamocil/tmux/pane.rb', line 4

def as_tmux
  [].tap do |tmux|
    tmux << Teamocil::Command::SplitWindow.new(root: root, name: name) unless first?
    tmux << Teamocil::Command::SendKeysToPane.new(index: internal_index, keys: commands.join('; ')) if commands
    tmux << Teamocil::Command::SendKeysToPane.new(index: internal_index, keys: 'Enter')
    tmux << Teamocil::Command::SelectLayout.new(layout: layout, name: name) if layout
  end
end

#internal_indexObject



13
14
15
# File 'lib/teamocil/tmux/pane.rb', line 13

def internal_index
  "#{name}.#{index + self.class.pane_base_index}"
end