Created
August 8, 2011 06:12
-
-
Save RichardBronosky/1131283 to your computer and use it in GitHub Desktop.
Tmux session syncronizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ## NOTE: currently this script doesn't have any syncing logic. | |
| ## It simply links to this session, all of the windows in the session passed as argument1. | |
| ## In the future I hope to make it idempotent. | |
| ## I could not find a quick way to get the tty or the pid of the windows. | |
| ## But, the good news is that renaming a window in one session changes it in all sessions. | |
| ## Therefore, I can save the name in a var, rename, look for it in the other session, change the name back. | |
| ## That will be the next advance. | |
| if [[ -z "$1" ]]; then | |
| echo "Please specify a session" | |
| exit 1 | |
| fi | |
| get_indexes(){ | |
| sed '/^[0-9]\{1,\}/!d; s/:.*//'</dev/stdin | |
| } | |
| for i in $(tmux list-windows -t $1 | get_indexes); do | |
| tmux link-window -s $1:$i | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment