Module: Teamocil::Tmux

Defined in:
lib/teamocil/tmux.rb,
lib/teamocil/tmux/pane.rb,
lib/teamocil/tmux/window.rb,
lib/teamocil/tmux/session.rb

Defined Under Namespace

Classes: Pane, Session, Window

Class Method Summary collapse

Class Method Details

.option(option, default: nil) ⇒ Object



3
4
5
6
7
# File 'lib/teamocil/tmux.rb', line 3

def self.option(option, default: nil)
  command = Teamocil::Command::ShowOptions.new(name: option)
  value = Teamocil.query_system(command).chomp
  value.empty? ? default : value.to_i
end

.pane_count(index: nil) ⇒ Object



20
21
22
23
# File 'lib/teamocil/tmux.rb', line 20

def self.pane_count(index: nil)
  command = Teamocil::Command::ListPanes.new(index: index)
  Teamocil.query_system(command).chomp.split("\n").size
end

.window_countObject



15
16
17
18
# File 'lib/teamocil/tmux.rb', line 15

def self.window_count
  command = Teamocil::Command::ListWindows.new
  Teamocil.query_system(command).chomp.split("\n").size
end

.window_option(option, default: nil) ⇒ Object



9
10
11
12
13
# File 'lib/teamocil/tmux.rb', line 9

def self.window_option(option, default: nil)
  command = Teamocil::Command::ShowWindowOptions.new(name: option)
  value = Teamocil.query_system(command).chomp
  value.empty? ? default : value.to_i
end