I'm trying to build a wrapper for tmux that presents me with a menu of all available sessions instead of creating a new one. However the man page explicitly says that this is not possible (excerpt from the choose-tree command):

This command works only if at least one client is attached.

How could I have a shell function / script to present me with the the menu above, but without goint into tmux first? Or maybe a shortcut to attach and show the chooser in one go?


Probably easiest is to create your own menu and then attach selected session. Something like following (replace select with dialog, zenity or whatever other menu):


select sel in $(tmux ls -F '#S'); do
tmux attach -t "$sel"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.