class Muxoro::Tmux

Attributes

current_session[R]

Public Class Methods

new(session_name, logger=nil) click to toggle source
# File lib/muxoro/tmux.rb, line 14
def initialize session_name, logger=nil
  @current_session = session_name.chomp
  @logger          = logger
  log "initialized"
end

Public Instance Methods

set_left_status(fg: nil, time: '', bg: 'grey') click to toggle source
# File lib/muxoro/tmux.rb, line 6
def set_left_status fg: nil, time: '', bg: 'grey'
  style = "bg=#{bg}"
  style = "fg=#{fg},#{style}" if fg
  tmux *%W{set-option -qt #{current_session} status-left-style #{style}}
  tmux *(%W{set-option -qt #{current_session} status-left} + ["Session: #{current_session} #{time}".strip.inspect])
end

Private Instance Methods

log(*msg) click to toggle source
# File lib/muxoro/tmux.rb, line 20
def log *msg
  return unless @logger
  @logger.info "#{msg.join " "}"
end
tmux(*args) click to toggle source
# File lib/muxoro/tmux.rb, line 25
def tmux *args
  log "tmux", *args
  system %{tmux #{args.join(' ')}}
end