Closed znd4 closed 4 months ago
Okay, so I know what is happening.
The intention of sesh is for every session name to be identical to the directory it's pointed to. So the logic currently looks up if a tmux session exists by the path of the tmux session, not the session name.
In your case, the nixfiles
session is pointing to the $HOME
directory and generating a new session based off your user name, not the custom name you defined.
The reason I did this was to make it easier to identify a tmux session from a zoxide result, rather than having to convert a zoxide result into a session name before doing the comparison.
I do recommend you avoid custom tmux sessions names when using sesh and always allow sesh to be the one to name tmux sessions on your behalf.
Would you like sesh to behave differently? I'm open to changing it if it works well for the sesh community.
I have encountered this aswell, my idea would be to rename the 0 session on the first opening of sesh, to its folder name
Sesh doesn't do any sort of transformation of sessions once they exist, it only creates or attaches/switches sessions. I recommend whatever logic you have create the first session always be a valid sesh session.
Hmm, I thought that only tmux panes / windows had working directories -- didn't know that sessions did as well.
I don't think it's worth changing sesh
's behavior in this instance -- hopefully this issue is enough documentation for people.
FWIW, I've changed my startup script to a simplified version of the one from the readme:
sesh connect $(sesh list | fzf)
My start script does something very similar, glad to clarify things.
And yes, sessions have a session_path
assigned on creation:
What happened?
when I run
sesh connect nixfiles
, I end up with a new session in/home/$USER
with name$USER
instead of connecting to my existing session namednixfiles
(which shows up insesh list -t
sesh connect
works as expected with every other session (includingsesh connect $USER
).I think the important detail here is that
nixfiles
is the first session -- my default wezterm program is (almost)EDIT: Extra debugging: I killed the existing
nixfiles
and$USER
sessions, ransesh connect ~/path/to/nixfiles
at which pointsesh connect
worked for all sessions.I suppose it might be possible as a workaround to write a tmux entry script that always kills the first session, but it seems like a bit of a headache
Version
dev (I'm building from source, currently locked to
be2badd29206f66803b76b62b23f6f5e05befe08
)Relevant log output
No response
Reviewed