feat(tmux): add a per-host mouse toggle and preserve remote configuration (#1513)

This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-09-30 09:53:17 -05:00
1 parent 99cffc9ba6
commit 9801cc7fc7
10 files changed
+183 -44

No files matched your search

@@ -77,6 +77,7 @@ export interface TmuxSessionsV1 {
stream: unknown,
name?: string,
newName?: string,
hostId?: number,
) => Promise<void>;
/** Waits for a new session to exist and returns its confirmed name. */
waitForSession: (client: unknown, name: string) => Promise<string>;
@@ -781,7 +781,12 @@ export function createTerminalSocket(deps: TerminalSocketDeps) {
const existingName = tmuxData.sessionName || undefined;
if (existingName) {
void tmux
.attachOrCreate(session.sshStream, existingName)
.attachOrCreate(
session.sshStream,
existingName,
undefined,
session.hostId,
)
.catch(() => {});
session.tmuxSessionName = existingName;
sshLogger.info("User selected tmux session to attach", {
@@ -798,7 +803,12 @@ export function createTerminalSocket(deps: TerminalSocketDeps) {
} else {
const newName = `termix-${session.hostId}-${Date.now().toString(36).slice(-4)}`;
void tmux
.attachOrCreate(session.sshStream, undefined, newName)
.attachOrCreate(
session.sshStream,
undefined,
newName,
session.hostId,
)
.catch(() => {});
const sshConn = session.sshConn;
if (sshConn) {
@@ -2159,7 +2169,7 @@ export function createTerminalSocket(deps: TerminalSocketDeps) {
// skip detection and reuse the same path as the manual
// "tmux_attach" websocket message.
void tmux
.attachOrCreate(stream, tmuxAttachSession)
.attachOrCreate(stream, tmuxAttachSession, undefined, id)
.catch(() => {});
{
const session = sessionManager.getSession(boundSessionId);
@@ -2196,7 +2206,7 @@ export function createTerminalSocket(deps: TerminalSocketDeps) {
} else if (detection.sessions.length === 0) {
const newName = `termix-${id}-${Date.now().toString(36).slice(-4)}`;
void tmux
.attachOrCreate(stream, undefined, newName)
.attachOrCreate(stream, undefined, newName, id)
.catch(() => {});
const confirmed = await tmux.waitForSession(
conn,