Find session with no connected users from the command line #3774
Replies: 2 comments
-
I have looked through the code a bit, and the information for the session manager and the cli command seem to come from totally different places .. This sparked the idea of maybe being able to use I'll maybe play around with that tonight a bit .. unless someone tells me "stop being stupid and just use this obvious way of doing it" :) |
Beta Was this translation helpful? Give feedback.
-
Hello! Do you know about the zellij welcome screen? It is not as automated as your own script, which would definitely be a nice solution - and a really nice plugin. It seems that others are halfway there, for example: https://github.com/mostafaqanbaryan/zellij-switch |
Beta Was this translation helpful? Give feedback.
-
Context
I have recently (well, its been months..) switched to zellij from tmux. I have my terminal (alacritty) configured to run zellij on startup, so it pretty much never comes up without zellij and when I close the terminal the zellij session is exited (detached would be the tmux term I guess - I'll use exited and detached synonymously for the rest of the post :) ).
For tmux I had a script that listed sessions, grepped if there are any detached sessions available and attached the first detached session if there was one - or created a new one if none were detached.
I had that script bound to alacritty, so whenever I opened a new terminal, it would either attach to an existing session that was currently detached / exited or create a new session.
I'd like to recreate this behavior in zellij, in principle the same script could be used, but zellij thinks about sessions a bit differently.
I currently have two terminals open, and when I look at my current session manager, it looks like this:
So all sessions are "not exited", rather the check I'll want to do is "which ones have no connected users?"
In the example above, I'd like to attach to
chatty-accordion'. All fine and dandy, but the output of
zellij list-sessions` sadly doesn't contain the connected users:Question
Is there a way to include the number of connected users per session in the output of
list-sessions
from the command line?Ideally I'd like a json representation of current sessions that lends itself well to parsing, but I'd also be happy to work with a text representation..
Beta Was this translation helpful? Give feedback.
All reactions