Skip to content

Commit 06ad5f9

Browse files
committed
fix: shared terminals from desktop app
1 parent eba7a98 commit 06ad5f9

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

app/components/Terminal.client.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const props = defineProps<{
2626
}>();
2727
2828
const emit = defineEmits<{
29-
shareCreated: [terminalId: string];
29+
shareCreated: [terminalId: string, name: string];
3030
}>();
3131
3232
const { getWsUrl, getMode, getSessionId } = useApi();
@@ -40,8 +40,8 @@ let resizeObserver: ResizeObserver | null = null;
4040
let ipcCleanups: (() => void)[] = [];
4141
let wsReconnectTimer: ReturnType<typeof setTimeout> | null = null;
4242
let disposed = false;
43-
// Use local node-pty only in Electron + local mode; SSH mode always uses WebSocket
44-
const useLocalPty = !!electronTerminal && getMode() === "local";
43+
// Use local node-pty only in Electron + local mode (not in share mode — share always uses WebSocket)
44+
const useLocalPty = !!electronTerminal && getMode() === "local" && !isSharing.value;
4545
4646
// Unique ID for this terminal instance (used for IPC routing)
4747
const termId = `t-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
@@ -114,7 +114,7 @@ function connectWs() {
114114
} else if (msg.type === "terminal-ready") {
115115
sharedTerminalId = msg.terminalId;
116116
if (!props.shareTerminalId) {
117-
emit("shareCreated", msg.terminalId);
117+
emit("shareCreated", msg.terminalId, msg.name ?? "");
118118
}
119119
} else if (msg.type === "output" && term) {
120120
term.write(msg.data);

app/components/TerminalPanel.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
:active="s.id === activeId || s.id === splitId"
3737
:focused="s.id === focusedId"
3838
:shareTerminalId="s.shareTerminalId"
39-
@shareCreated="terminalId => onShareCreated(s.id, terminalId)" />
39+
@shareCreated="(terminalId, name) => onShareCreated(s.id, terminalId, name)" />
4040
</div>
4141
</div>
4242
<div v-if="!isMobile" class="terminal-sidebar">
@@ -174,13 +174,14 @@ function focusTerminal(id: string) {
174174
nextTick(() => termRefs[id]?.focus());
175175
}
176176
177-
function onShareCreated(localId: string, serverTerminalId: string) {
177+
function onShareCreated(localId: string, serverTerminalId: string, serverName: string) {
178178
const s = sessions.value.find(s => s.id === localId);
179179
if (s) {
180180
s.shareTerminalId = serverTerminalId;
181+
if (serverName) s.name = serverName;
181182
knownShareIds.add(serverTerminalId);
182183
// Add to sharedTerminals so terminal-removed can clean it up
183-
addSharedTerminal(serverTerminalId, s.name);
184+
addSharedTerminal(serverTerminalId, serverName || s.name);
184185
}
185186
}
186187

0 commit comments

Comments
 (0)