Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On connect, create a new tmux session and move the relevant window in #155

Open
canadaduane opened this issue Apr 20, 2023 · 1 comment
Open

Comments

@canadaduane
Copy link

(For context--My team is new to tmux. Overmind has been a fantastic process management solution in conjunction with turborepo for us).

Use case:

  • Connect to one overmind/tmux session per Mac OS Terminal tab

We'd like to be able to open multiple tabs in Terminal, and run overmind connect [service] once per tab, with a different service per tab. However, currently, when connecting to more than one service in this way, tmux treats it as the same session and essentially makes ALL tabs view the same window (tmux has a concept of one current/active window per session).

Is there a way to disable this behavior, or create a new session per overmind connect [service] call, and move the tmux window for that service into that session?

@canadaduane
Copy link
Author

canadaduane commented Apr 21, 2023

Ok, here's a solution:

I added the following to overmind.tmux.conf (the tmux config that we load via the -F switch, e.g. overmind start -F scripts/overmind.tmux.conf):

set-hook -g client-attached "run 'sess=\`tmux new -d -P -t \"#{session_name}\"\` && tmux switch-cli -t \"\${sess}#{window_index}\"'"

Whenever a new client attaches, this creates a new session within the same overmind session-group (a session-group shares all windows within all sessions), and switches to the same window_index as was current before creating the new session.

This is allows us to open a different "current window" in each new Terminal tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant