예제 #1
0
 def _execute_pre_shell_cmds(self):
     """
     Runs any pre commands and is used before panes are created in the
     windows.
     """
     for cmd in self.pre_shell_cmds:
         _execute("{} send-keys -t 0 {} 'C-m'".format(self.tmux, cmd))
예제 #2
0
 def _send_keys(self, pane_cmd):
     cmd = '{} send-keys -t {} "{}" "C-m"'.format(
         self.tmux,
         self.pane_number,
         pane_cmd
     )
     _execute(cmd)
예제 #3
0
 def _execute_pre_shell_cmds(self):
     """
     Runs any pre commands and is used before panes are created in the
     windows.
     """
     for cmd in self.pre_shell_cmds:
         _execute("{} send-keys -t 0 {} 'C-m'".format(self.tmux, cmd))
예제 #4
0
 def create(self):
     if self.win_num == 0:
         _execute("{} {} {}".format(self.tmux, 'new-session -d -s',
                                    self.session_name))
         _execute("{} {} '{}'".format(self.tmux, 'rename-window',
                                      self.config.get('windows.0.name')))
     else:
         _execute("{} {}".format(self.tmux, 'new-window'))
         _execute("{} {} '{}'".format(self.tmux, 'rename-window',
                                      self.name))
     self._execute_pre_shell_cmds()
     self.create_panes()
예제 #5
0
 def create(self):
     if self.win_num == 0:
         _execute("{} {} {}".format(self.tmux, 'new-session -d -s', self.session_name))
         _execute("{} {} '{}'".format(
             self.tmux, 'rename-window',
             self.config.get('windows.0.name'))
         )
     else:
         _execute("{} {}".format(self.tmux, 'new-window'))
         _execute("{} {} '{}'".format(self.tmux, 'rename-window', self.name))
     self._execute_pre_shell_cmds()
     self.create_panes()
예제 #6
0
 def _attach_to_session(self):
     _execute("{} {} {}".format(self.tmux, '-2 attach-session -t',
                                self.name),
              capture=True)
예제 #7
0
 def build(self):
     if not self.config:
         #Default Configuration
         _execute("{} {}".format(self.tmux, 'new-session -d -s test'))
         _execute("{} {}".format(self.tmux, 'select-window -t test:0'))
         _execute("{} {}".format(self.tmux, 'split-window -v'))
         _execute("{} {}".format(self.tmux, 'split-window -h -t 1'))
         _execute("{} {}".format(self.tmux, 'resize-pane -y 55 -t 0'))
         _execute("{} {}".format(self.tmux,
                                 'send-keys -t 0 "ls -ltr" "C-m"'))
         _execute("{} {}".format(self.tmux, 'send-keys -t 1 "pwd" "C-m"'))
         _execute("{} {}".format(self.tmux, 'send-keys -t 2 "htop" "C-m"'))
         _execute("{} {}".format(self.tmux, '-2 attach-session -t test'),
                  capture=True)
     else:
         config = kaptan.Kaptan()
         config.import_config(self.config)
         session_name = config.get('session_name', '')
         session = Session(session_name, config, self.tmux)
         session.create()
예제 #8
0
 def __init__(self, config=None, server=None):
     """
     If conf is None, it builds the default conf
     """
     self.tmux = _execute('which tmux', capture=True)
     self.config = config
예제 #9
0
 def _send_keys(self, pane_cmd):
     cmd = '{} send-keys -t {} "{}" "C-m"'.format(self.tmux,
                                                  self.pane_number,
                                                  pane_cmd)
     _execute(cmd)
예제 #10
0
 def create(self):
     cmd = "{} {}".format(self.tmux, self.cmds)
     _execute(cmd)
예제 #11
0
 def resize(self, size):
     cmd = "{} resize-pane -y {} -t {} ".format(self.tmux, size,
                                                self.pane_number)
     _execute(cmd)
예제 #12
0
 def _attach_to_session(self):
     _execute("{} {} {}".format(
         self.tmux, '-2 attach-session -t', self.name),
         capture=True
     )
예제 #13
0
 def build(self):
     if not self.config:
         #Default Configuration
         _execute("{} {}".format(self.tmux, 'new-session -d -s test'))
         _execute("{} {}".format(self.tmux, 'select-window -t test:0'))
         _execute("{} {}".format(self.tmux, 'split-window -v'))
         _execute("{} {}".format(self.tmux, 'split-window -h -t 1'))
         _execute("{} {}".format(self.tmux, 'resize-pane -y 55 -t 0'))
         _execute("{} {}".format(self.tmux, 'send-keys -t 0 "ls -ltr" "C-m"'))
         _execute("{} {}".format(self.tmux, 'send-keys -t 1 "pwd" "C-m"'))
         _execute("{} {}".format(self.tmux, 'send-keys -t 2 "htop" "C-m"'))
         _execute("{} {}".format(self.tmux, '-2 attach-session -t test'), capture=True)
     else:
         config = kaptan.Kaptan()
         config.import_config(self.config)
         session_name = config.get('session_name', '')
         session = Session(session_name, config, self.tmux)
         session.create()
예제 #14
0
 def __init__(self, config=None, server=None):
     """
     If conf is None, it builds the default conf
     """
     self.tmux = _execute('which tmux', capture=True)
     self.config = config
예제 #15
0
 def create(self):
     cmd = "{} {}".format(self.tmux, self.cmds)
     _execute(cmd)
예제 #16
0
 def resize(self, size):
     cmd = "{} resize-pane -y {} -t {} ".format(self.tmux, size, self.pane_number)
     _execute(cmd)