Add pinnable new-tab targets to the tab row and sidebar
Any new-tab target (new agent, terminal, browser, or a terminal profile) can be pinned as a quick-launch button. Pins are global client app state (persisted), not daemon config, so the same set shows on every workspace; profile pins resolve per host and are dropped where that profile is absent. The sidebar mirror launches via a navigate-then-launch intent store rather than calling the create handlers directly: terminal creation only works in the mounted/focused workspace, so the sidebar requests the launch and the workspace screen consumes it on focus.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import type { TerminalProfile } from "@getpaseo/protocol/messages";
|
||||
import type { TerminalProfileInput } from "@/screens/workspace/terminals/use-workspace-terminals";
|
||||
import type { PinnedTabTarget } from "@/workspace-pins/target";
|
||||
|
||||
export interface TabTargetHandlers {
|
||||
createDraft: () => void;
|
||||
createTerminal: () => void;
|
||||
createBrowser: () => void;
|
||||
createTerminalWithProfile: (profile: TerminalProfileInput) => void;
|
||||
}
|
||||
|
||||
export function runPinnedTabTarget(
|
||||
target: PinnedTabTarget,
|
||||
profiles: readonly TerminalProfile[],
|
||||
handlers: TabTargetHandlers,
|
||||
): void {
|
||||
if (target.kind === "draft") {
|
||||
handlers.createDraft();
|
||||
return;
|
||||
}
|
||||
if (target.kind === "terminal") {
|
||||
handlers.createTerminal();
|
||||
return;
|
||||
}
|
||||
if (target.kind === "browser") {
|
||||
handlers.createBrowser();
|
||||
return;
|
||||
}
|
||||
const profile = profiles.find((entry) => entry.id === target.profileId);
|
||||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
handlers.createTerminalWithProfile({
|
||||
name: profile.name,
|
||||
command: profile.command,
|
||||
args: profile.args,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user