diff --git a/tmuxssh.py b/tmuxssh.py index 354689e..1427dd2 100755 --- a/tmuxssh.py +++ b/tmuxssh.py @@ -29,7 +29,7 @@ def tmux(self, *args): return subprocess.call(['tmux'] + list(args)) def split_window(self, command): - self.tmux('split-window', '-t', self._session_name, command) + self.tmux('split-window', '-dt', self._session_name, command) def select_layout(self, layout): self.tmux('select-layout', '-t', self._session_name, layout) @@ -41,7 +41,7 @@ def set_window_option(self, option, value): self.tmux('set-window-option', '-t', self._session_name, option, value) def kill_pane(self, n): - self.tmux('kill-pane', '-t', str(n)) + self.tmux('kill-pane', '-t', '{}:{}'.format(self._session_name, n)) def kill_session(self): self.tmux('kill-session', '-t', self._session_name) @@ -68,6 +68,9 @@ def main(): hosts = (h for host in args.get('') for h in host.split()) template = args.get('--template') or 'ssh {}' commands = (ssh_command(host, template) for host in hosts) + # Allow nesting inside another tmux session. + # (Should be safe,since we're creating a new session anyway). + os.environ.pop('TMUX') tmux_commands(commands) except EnvironmentError: print('You need to install tmux before using this script.')