ThePrimeagen / .dotfiles

3.01k stars 303 forks source link

tmux-sessionizer no client selected #32

Open jrock2004 opened 1 year ago

jrock2004 commented 1 year ago

Steps to Produce:

You get a message that no client is selected. If you do a tmux list-sessions you see that it actually created the session but for some reason it did not attach

If I am in a tmux session this issue does not come up.

Odaym commented 1 year ago

Correct

Do notice though that sessions are created in this case anyway, if you experience the above and then do tmux list-sessions you will see the session you wanted to navigate to was indeed created.

Another thing is that when you do tmux kill-server right after encountering the above and then run tmux-sessionizer after it, it works again.

Even if you exit the session, tmux-sessionizer will still work, the only time it will do the above is indeed when detaching from a session and then attempting it again. Just confirming here.

Odaym commented 1 year ago

Actually I solved this, so you know how the very last line of the script had tmux switch-client -t $selected_name ?

It should have this instead:

if [[ -z $TMUX ]]; then
    tmux attach-session -t $selected_name
else
    tmux switch-client -t $selected_name
fi

Now if you kill server or detach or kill session or whatever, running tmux-sessionizer from the terminal will always land you in a new tmux session with the directory name as a name.