Skip to content

Instantly share code, notes, and snippets.

@qtip
Last active December 24, 2015 07:59
Show Gist options
  • Save qtip/6767625 to your computer and use it in GitHub Desktop.
Save qtip/6767625 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from sh import tmux
curwin = tmux('display-message', p='#{window_index}').strip()
windows = [line.split()[0].strip(':') for line in tmux('list-windows')]
for src, dest in zip(windows, range(1, len(windows)+1)):
if str(src) == str(curwin):
curwin = dest
if str(dest) != str(src):
tmux('move-window', s=src, t=dest)
tmux('select-window', t=curwin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment