experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: support groupMode option in window-open, track v2 tiles in getRunningExtensions

+46 -16
+31 -16
backend/electron/ipc.ts
··· 2594 2594 } 2595 2595 } 2596 2596 2597 - // Check for space mode inheritance from options 2598 - // If opener passed spaceMode, inherit it instead of URL-based detection 2597 + // Check for explicit mode inheritance from options: spaceMode or groupMode. 2598 + // If opener passed spaceMode/groupMode, set that mode explicitly. 2599 2599 if (options.spaceMode) { 2600 2600 const { spaceId, spaceName, color } = options.spaceMode; 2601 - // Set space mode via context API 2602 2601 addContextEntry('mode', 'space', { 2603 2602 windowId: win.id, 2604 2603 source: msg.source, 2605 2604 metadata: { spaceId, spaceName, color, url: modeUrl } 2606 2605 }); 2607 2606 DEBUG && console.log('Inherited space mode for window:', win.id, 'space:', spaceName); 2607 + } else if (options.groupMode) { 2608 + const { groupId, groupName, color } = options.groupMode; 2609 + addContextEntry('mode', 'group', { 2610 + windowId: win.id, 2611 + source: msg.source, 2612 + metadata: { groupId, groupName, color, url: modeUrl } 2613 + }); 2614 + DEBUG && console.log('Inherited group mode for window:', win.id, 'group:', groupName); 2608 2615 } else { 2609 - // Check if opener is in space mode - inherit if so 2610 - let openerSpaceMode = null; 2616 + // No explicit mode option — check if opener is in space or group mode and inherit. 2617 + let openerModeValue: string | null = null; 2618 + let openerMetadata: Record<string, unknown> | null = null; 2619 + let openerWindowId: number | null = null; 2611 2620 const callingWin = BrowserWindow.fromWebContents(ev.sender); 2612 2621 if (callingWin && !callingWin.isDestroyed()) { 2613 2622 const openerContext = getContextEntry('mode', callingWin.id); 2614 - if (openerContext && openerContext.value === 'space' && openerContext.metadata) { 2615 - openerSpaceMode = openerContext; 2623 + if ( 2624 + openerContext && 2625 + (openerContext.value === 'space' || openerContext.value === 'group') && 2626 + openerContext.metadata 2627 + ) { 2628 + openerModeValue = openerContext.value as string; 2629 + openerMetadata = openerContext.metadata as Record<string, unknown>; 2630 + openerWindowId = openerContext.windowId as number; 2616 2631 } 2617 2632 } 2618 2633 2619 - if (openerSpaceMode) { 2620 - // Inherit space mode from opener (window lineage) 2621 - addContextEntry('mode', 'space', { 2634 + if (openerModeValue && openerMetadata) { 2635 + // Inherit mode from opener (window lineage) 2636 + addContextEntry('mode', openerModeValue, { 2622 2637 windowId: win.id, 2623 2638 source: msg.source, 2624 2639 metadata: { 2625 - ...openerSpaceMode.metadata, 2640 + ...openerMetadata, 2626 2641 url: modeUrl, 2627 - inheritedFrom: openerSpaceMode.windowId 2642 + inheritedFrom: openerWindowId 2628 2643 } 2629 2644 }); 2630 - DEBUG && console.log('Inherited space mode from opener:', openerSpaceMode.metadata?.spaceName); 2645 + DEBUG && console.log(`Inherited ${openerModeValue} mode from opener`); 2631 2646 } else { 2632 - // No space mode inheritance — only explicit spaceMode option or direct 2633 - // opener lineage propagates space mode. Do NOT fall back to 2634 - // lastFocusedVisibleWindowId, as that causes space leakage to unrelated 2647 + // No mode inheritance — only explicit spaceMode/groupMode option or direct 2648 + // opener lineage propagates mode. Do NOT fall back to 2649 + // lastFocusedVisibleWindowId, as that causes mode leakage to unrelated 2635 2650 // windows (external app opens, peeks, slides, etc.) 2636 2651 const detectedMode = detectModeFromUrl(modeUrl); 2637 2652 addContextEntry('mode', detectedMode, {
+15
backend/electron/main.ts
··· 15 15 import { initCmd } from './cmd-glue.js'; 16 16 import { discoverExtensions, loadExtensionManifest, isBuiltinExtensionEnabled, getExternalExtensions, type ExtensionManifest, type ManifestCommand, type ManifestShortcut } from './extensions.js'; 17 17 import { initializeFeatures, type FeatureStartupResult } from './feature-startup.js'; 18 + import { getLoadedTileIds, getTileManifest } from './tile-launcher.js'; 18 19 import { initTray } from './tray.js'; 19 20 import { registerLocalShortcut, unregisterLocalShortcut, handleLocalShortcut, registerGlobalShortcut, unregisterGlobalShortcut, unregisterShortcutsForAddress } from './shortcuts.js'; 20 21 import { scopes, publish, subscribe, unsubscribe, hasSubscriber, setExtensionBroadcaster, getSystemAddress } from './pubsub.js'; ··· 1550 1551 running.push({ 1551 1552 id: extId, 1552 1553 manifest: manifest || { id: extId }, 1554 + status: 'running' 1555 + }); 1556 + } 1557 + 1558 + // Add v2 tiles launched by the tile-launcher as separate BrowserWindows. 1559 + // These aren't in loadedConsolidatedExtensions (that's for iframes in the host) 1560 + // or extensionWindows (that's for legacy external extensions). 1561 + for (const tileId of getLoadedTileIds()) { 1562 + if (running.some(r => r.id === tileId)) continue; 1563 + if (!isBuiltinExtensionEnabled(tileId)) continue; 1564 + const tileManifest = getTileManifest(tileId); 1565 + running.push({ 1566 + id: tileId, 1567 + manifest: tileManifest || { id: tileId }, 1553 1568 status: 'running' 1554 1569 }); 1555 1570 }