tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

no socket support

Open regisz opened this issue 8 years ago • 10 comments

Hi,

I use more sockets (see e.g. tmux -L option) in the same place, but I can not save separately my tmux sessions per sockets. Is there any solution for this, or is this a feature request?

Thx!

regisz avatar Sep 26 '17 08:09 regisz

Hi, this is a new feature - kinda.

Your sessions ARE saved as separate files in ~/.tmux/resurrect/ dir. But only the last saved file will ever be restored automatically. You can manipulate those files, specifically the ~/.tmux/resurrect/last symlink to restore other saved files.

That said, here's my thoughts about using multiple sockets:

  • You should not be using them. Whatever your use-case is it can probably be done with a single tmux server/socket. In my 3-4 years of tmux use I've never really needed this feature except for short-term testing.
  • This is a very obscure feature. I think this is a first-ever report/request for supporting it across all tmux plugins.

bruno- avatar Sep 26 '17 14:09 bruno-

I see, so you can not develop this feature if I understand well :(. So, I have the reason why I use more sockets. I work on a host, but I have 2 (or 3) very different projects. And in a project, more sessions are very useful for me. So, as I said, I have the reasons for more sockets (not only temporarily) :). But, fortunately, I can workaround this problem, as you said, but it would be more elegant if your plugin supported this :).

regisz avatar Sep 26 '17 19:09 regisz

And in a project, more sessions are very useful for me.

Why not keep sessions for all projects in a single tmux instance? I keep dozens of sessions of very different projects open all the time. I usually go with 1 project = 1 tmux session. If I need multiple sessions for 1 project I just add a number to the session name so I end up with these sessions myproject, myproject2, myproject3.

bruno- avatar Sep 28 '17 10:09 bruno-

:) So, I have 2 bigger projects, and these projects have more projects too. So, I use 5-6 sessions in a socket. :).

regisz avatar Sep 28 '17 20:09 regisz

Ok, tmux should be able to handle many more sessions than that (also many windows inside those sessions). I regularly run 50-60 sessions for a couple years now.

The only "roadblock" I found is switching sessions when there's many of them. 'prefix-s' becomes unusable. I built https://github.com/tmux-plugins/tmux-sessionist to allow faster session switching. It's fast and from what I know all the bugs are ironed out 👌

Let me know if that works for you

On 2017-09-28, Regényi Balázs wrote:

:) So, I have 2 bigger projects, and these projects have more projects too. So, I use 5-6 sessions in a socket. :).

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/tmux-plugins/tmux-resurrect/issues/207#issuecomment-332950705

bruno- avatar Sep 28 '17 20:09 bruno-

Ok, I will try it.

regisz avatar Sep 28 '17 20:09 regisz

Ok, I tried tmux-sessionist. Not bad, but the benefits are not too much for me (e.g. in prefix-g the completion does not work for me).

regisz avatar Nov 03 '17 14:11 regisz

How do you do the "completion"? It's not the actual tab-completion: if you have a session name "my_foo", they typing just "my" + enter should switch you to the session. Even though you don't see the completed name, the benefit is you don't have to type the full name out.

On 2017-11-03 14:39, Regényi Balázs wrote:

Ok, I tried tmux-sessionist. Not bad, but the benefits are not too much for me (e.g. in prefix-g the completion does not work for me).

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/tmux-plugins/tmux-resurrect/issues/207#issuecomment-341722075

bruno- avatar Nov 03 '17 22:11 bruno-

Well, not bad, but, I think, the prefix + g is a weaker solution than prefix + s because I can select a window too with prefix + s. Maybe, if someone uses a lot of sessions with a few windows, then your tmux-sessionist plugin is useful :).

regisz avatar Nov 07 '17 10:11 regisz

@bruno-

Hi, this is a new feature - kinda.

Your sessions ARE saved as separate files in ~/.tmux/resurrect/ dir. But only the last saved file will ever be restored automatically. You can manipulate those files, specifically the ~/.tmux/resurrect/last symlink to restore other saved files.

That said, here's my thoughts about using multiple sockets:

* You should not be using them. Whatever your use-case is it can probably be done with a single tmux server/socket. In my 3-4 years of tmux use I've never really needed this feature except for short-term testing.

* This is a very obscure feature. I think this is a first-ever report/request for supporting it across all tmux plugins.

FYI we use the -L flag to create different sockets, and it works great for us. We are using shared accounts on Linux hosts that use shell functions and aliases to emulate multi-user sessions. We alias tmux to tmux -L $EMULATED_USERNAME and this works very well for us. Retooling everything to use sessions instead of sockets, and then deploying that change across our hosts would not be worth it for the resurrect plugin. The -L feature is part of tmux so I don't see why supporting it is considered outlandish.

sagargp avatar Apr 14 '23 21:04 sagargp