Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/providers/toolbar.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,21 @@ export class WorkspaceToolbarProvider extends ToolbarButtonProvider {

if (!workspace) return

// Register startup commands BEFORE opening the workspace
// Commands will be sent via sendInput() when terminals open
// Register startup commands BEFORE opening the workspace so the service can
// match panes as they appear. Commands are sent via sendInput() once each
// pane's PTY session is connected and its shell prompt has rendered.
const commands = this.workspaceService.collectStartupCommands(workspace)
if (commands.length > 0) {
this.startupService.registerCommands(commands)
}
const startupDone = commands.length > 0
? this.startupService.registerCommands(commands)
: Promise.resolve()

const profile = await this.workspaceService.generateTabbyProfile(workspace)
this.profilesService.openNewTabForProfile(profile)

// Serialize launches: wait until this workspace's panes are connected and
// their commands sent before returning. The next startup workspace then
// opens in the foreground, so its PTY sessions actually initialize instead
// of being left disconnected in the background (issue #14, root cause #3).
await startupDone
}
}
Loading