jrmoulton/tmux-sessionizer

tms to attach if tmux session is attached

Closed this issue · 1 comments

I suppose this is more of a feature request. If there is an attached tmux session in another terminal, tms will not attach to the selected project if used outside tmux.

Steps to reproduce:

  1. attach to a tmux session for project A in terminal 1 (doesnt matter if with tms or directly with tmux)
  2. open a new terminal 2
  3. use tms in terminal 2 to connect to project B (doesnt matter if new or existing session)

Current behaviour:
Terminal 1 which is attached to tmux changes to project B session
Terminal 2 does not attach to tmux

Expected behaviour:
Terminal 1 stays in project A session
Terminal 2 attaches to project B session

I've not had time to look at the code and how easy this is to implement considering how tmux works. If I find some time in the future I'd be open to create a PR, but might take a while.

Ahh interesting. Should be possible by adding a check to see if tmux isn't already attached and if not attaching and then executing the command to open/switch.

https://github.com/jrmoulton/tmux-sessionizer/blob/46bdf4ab651525b746a8704c225e5ae4ce25a2ae/src/main.rs#L80C3-L97C11

Somewhere in there