Skip to content

Commit 8db9026

Browse files
committed
Switch to existing session
1 parent 8cf07a0 commit 8db9026

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tmuxp/workspacebuilder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def build(self, session=None, append=False):
128128
{'session_name': self.sconf['session_name']}
129129
)
130130
raise TmuxSessionExists(
131-
'Session name %s is already running.' % self.sconf['session_name']
131+
session = self.server.switch_client(self.sconf['session_name'])
132132
)
133133
else:
134134
session = self.server.new_session(
@@ -353,7 +353,8 @@ def config_after_window(self, w, wconf):
353353
w.set_window_option(key, val)
354354

355355
def find_current_attached_session(self):
356-
return self.server.list_sessions()[0]
356+
sid = self.server.cmd("display", "-pt", os.environ['TMUX_PANE'], "#{session_id}")
357+
return self.server.get_by_id(sid.stdout[0])
357358

358359
def first_window_pass(self, i, session, append_same_sassion):
359360
return len(session.windows) == 1 and i == 1 and not append_same_sassion

0 commit comments

Comments
 (0)