(evtMsg: WSEventType)
| 85 | } |
| 86 | |
| 87 | function handleWSEvent(evtMsg: WSEventType) { |
| 88 | fireAndForget(async () => { |
| 89 | console.log("handleWSEvent", evtMsg?.eventtype); |
| 90 | if (evtMsg.eventtype == "electron:newwindow") { |
| 91 | console.log("electron:newwindow", evtMsg.data); |
| 92 | const windowId: string = evtMsg.data; |
| 93 | const windowData: WaveWindow = (await services.ObjectService.GetObject("window:" + windowId)) as WaveWindow; |
| 94 | if (windowData == null) { |
| 95 | return; |
| 96 | } |
| 97 | const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient); |
| 98 | const newWin = await createBrowserWindow(windowData, fullConfig, { |
| 99 | unamePlatform, |
| 100 | isPrimaryStartupWindow: false, |
| 101 | }); |
| 102 | newWin.show(); |
| 103 | } else if (evtMsg.eventtype == "electron:closewindow") { |
| 104 | console.log("electron:closewindow", evtMsg.data); |
| 105 | if (evtMsg.data === undefined) return; |
| 106 | const ww = getWaveWindowById(evtMsg.data); |
| 107 | if (ww != null) { |
| 108 | ww.destroy(); // bypass the "are you sure?" dialog |
| 109 | } |
| 110 | } else if (evtMsg.eventtype == "electron:updateactivetab") { |
| 111 | const activeTabUpdate: { workspaceid: string; newactivetabid: string } = evtMsg.data; |
| 112 | console.log("electron:updateactivetab", activeTabUpdate); |
| 113 | const ww = getWaveWindowByWorkspaceId(activeTabUpdate.workspaceid); |
| 114 | if (ww == null) { |
| 115 | return; |
| 116 | } |
| 117 | await ww.setActiveTab(activeTabUpdate.newactivetabid, false); |
| 118 | } else { |
| 119 | console.log("unhandled electron ws eventtype", evtMsg.eventtype); |
| 120 | } |
| 121 | }); |
| 122 | } |
| 123 | |
| 124 | // we try to set the primary display as index [0] |
| 125 | function getActivityDisplays(): ActivityDisplayType[] { |
no test coverage detected