diff --git a/src/web/public/app.js b/src/web/public/app.js index 5965a181..b9ffd575 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -1369,6 +1369,8 @@ class CodemanApp { if (this.attachmentHistoryDrawerOpen) this.closeAttachmentHistory(); this.closeSessionManager(); this.closeCommandPalette?.(); + this.closeTilePicker?.(); + this.closeTileAddMenu?.(); this.closeShortcutOverlay?.(); // Overlay layouts only: below 1024px the sidebar is a modal off-canvas // drawer over the terminal, so Escape must close it. The docked desktop diff --git a/src/web/public/constants.js b/src/web/public/constants.js index efcb996f..0b0ed6dd 100644 --- a/src/web/public/constants.js +++ b/src/web/public/constants.js @@ -1741,6 +1741,29 @@ function sanitizeTileGridState(raw, liveSessions, detachedIds) { }; } +/** + * The sessions the Tiles picker (and a tile's + menu) offers, in tab order: + * live ones only, never a session popped out to its own window (that window + * owns its PTY size). A session with no PTY attached IS offered: its tile shows + * the Attach overlay. + * + * @param {Map} sessions + * @param {string[]} sessionOrder + * @param {{has(id: string): boolean}} [detachedIds] + * @param {{has(id: string): boolean}} [exclude] - ids not to offer (already tiled) + * @returns {Array<{id: string, label: string}>} + */ +function buildTilePickerSessions(sessions, sessionOrder, detachedIds, exclude) { + const result = []; + for (const id of sessionOrder) { + if (detachedIds?.has?.(id) || exclude?.has?.(id)) continue; + const session = sessions.get(id); + if (!session) continue; + result.push({ id, label: session.name || 'Session' }); + } + return result; +} + /** * Which tile takes focus when `id` leaves the grid: the next one in grid * order, else the previous one, else null. @@ -2050,6 +2073,7 @@ if (typeof window !== 'undefined') { computeTileLayout, tileGridCapacity, sanitizeTileGridState, + buildTilePickerSessions, tileNeighbor, tileInDirection, cycleTile, diff --git a/src/web/public/index.html b/src/web/public/index.html index 2e83db29..0cbbebec 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -192,6 +192,7 @@ +
—