diff --git a/tmuxp/cli.py b/tmuxp/cli.py index d206c76a6e0..d5ea6a969ec 100644 --- a/tmuxp/cli.py +++ b/tmuxp/cli.py @@ -321,11 +321,24 @@ def reattach(session): reattach(builder.session) return + session = None + if session_name == 'current': + sessions = t.list_sessions() or [] + for s in sessions: + if s.attached == '1' and (answer_yes or click.confirm( + 'Reuse session [%s]?' % s.name + )): + session = s + # need to create a new window, + # or the currently-active one will be clobbered + session.new_window() + break + try: click.echo( click.style('[Loading] ', fg='green') + click.style(config_file, fg='blue', bold=True)) - builder.build() + builder.build(session) if 'TMUX' in os.environ: # tmuxp ran from inside tmux if not detached and (answer_yes or click.confirm(