diff --git a/desktop/electron/src/window.ts b/desktop/electron/src/window.ts index 0fac17ff..68fa9a9c 100644 --- a/desktop/electron/src/window.ts +++ b/desktop/electron/src/window.ts @@ -18,17 +18,20 @@ export function getAppView() { } function resizeAppView() { - if (!mainWindow || !appView) { - return; - } + // TODO: workaround: set timeout is needed as mainWindow.getBounds() needs some time to update + setTimeout(() => { + if (!mainWindow || !appView) { + return; + } - const { width, height } = mainWindow.getBounds(); + const { width, height } = mainWindow.getBounds(); - appView.setBounds({ - x: sidebarWidth, - y: 0, - width: width - sidebarWidth, - height: height, + appView.setBounds({ + x: sidebarWidth, + y: 0, + width: width - sidebarWidth, + height: height, + }); }); } @@ -92,16 +95,7 @@ export async function createWindow() { }); resizeAppView(); appView.setAutoResize({ width: true, height: true }); - - // TODO: workaround to fix appView resizing when window is resized - mainWindow.on("maximize", resizeAppView); - mainWindow.on("unmaximize", resizeAppView); - mainWindow.on("minimize", resizeAppView); - mainWindow.on("restore", resizeAppView); mainWindow.on("resize", resizeAppView); - mainWindow.on("show", resizeAppView); - mainWindow.on("enter-full-screen", resizeAppView); - mainWindow.on("leave-full-screen", resizeAppView); mainWindow.once("ready-to-show", () => { mainWindow?.show();