Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tmuxssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -68,6 +68,9 @@ def main():
hosts = (h for host in args.get('<host>') 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.')
Expand Down