MCPcopy
hub / github.com/wavetermdev/waveterm / createNewWaveWindow

Function createNewWaveWindow

emain/emain-window.ts:831–867  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

829});
830
831export async function createNewWaveWindow() {
832 log("createNewWaveWindow");
833 const clientData = await ClientService.GetClientData();
834 const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient);
835 let recreatedWindow = false;
836 const allWindows = getAllWaveWindows();
837 if (allWindows.length === 0 && clientData?.windowids?.length >= 1) {
838 console.log("no windows, but clientData has windowids, recreating first window");
839 // reopen the first window
840 const existingWindowId = clientData.windowids[0];
841 const existingWindowData = (await ObjectService.GetObject("window:" + existingWindowId)) as WaveWindow;
842 if (existingWindowData != null) {
843 const win = await createBrowserWindow(existingWindowData, fullConfig, {
844 unamePlatform,
845 isPrimaryStartupWindow: false,
846 });
847 if (quakeWindow == null) {
848 quakeWindow = win;
849 }
850 win.show();
851 recreatedWindow = true;
852 }
853 }
854 if (recreatedWindow) {
855 console.log("recreated window, returning");
856 return;
857 }
858 console.log("creating new window");
859 const newBrowserWindow = await createBrowserWindow(null, fullConfig, {
860 unamePlatform,
861 isPrimaryStartupWindow: false,
862 });
863 if (quakeWindow == null) {
864 quakeWindow = newBrowserWindow;
865 }
866 newBrowserWindow.show();
867}
868
869export async function relaunchBrowserWindows() {
870 console.log("relaunchBrowserWindows");

Callers 2

quakeToggleFunction · 0.85

Calls 6

logFunction · 0.90
getAllWaveWindowsFunction · 0.85
createBrowserWindowFunction · 0.85
GetFullConfigCommandMethod · 0.65
GetClientDataMethod · 0.45
GetObjectMethod · 0.45

Tested by

no test coverage detected