experiments in a post-browser web
10
fork

Configure Feed

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

fix(shortcuts): use BrowserWindow ID not WebContents ID for shortcut callbacks

ev.sender.id is the webContents ID, not the BrowserWindow ID.
BrowserWindow.fromId() requires window ID. Use fromWebContents()
to get the correct window reference.

+4 -2
+4 -2
backend/electron/ipc.ts
··· 2763 2763 const modeStr = msg.mode ? ` mode:${msg.mode}` : ''; 2764 2764 DEBUG && console.log('ipc register shortcut', msg.shortcut, isGlobal ? '(global)' : '(local)', modeStr); 2765 2765 2766 - // Capture window ID at registration time — ev.sender may be destroyed when shortcut fires later 2767 - const windowId = ev.sender?.id; 2766 + // Capture BrowserWindow ID at registration time — ev.sender (WebContents) may be destroyed when shortcut fires later 2767 + const senderWindow = BrowserWindow.fromWebContents(ev.sender); 2768 + const windowId = senderWindow?.id; 2768 2769 const callback = () => { 2769 2770 DEBUG && console.log('on(registershortcut): shortcut executed', msg.shortcut, msg.replyTopic); 2771 + if (!windowId) return; 2770 2772 const win = BrowserWindow.fromId(windowId); 2771 2773 if (win && !win.isDestroyed()) { 2772 2774 win.webContents.send(msg.replyTopic, { foo: 'bar' });