fix(desktop-client): make settings window a child of main window on Windows

Sets the settings window parent on creation and re-applies it on reveal
so it stays modal to the main window on win32.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Xu Liang
2026-05-02 14:42:36 +08:00
parent fd7b1b71c3
commit 0b9ca39c9f
+12
View File
@@ -466,9 +466,20 @@ function queueWindowModeSwitch(
async function openSettingsWindow(): Promise<void> {
const window = await ensureSettingsWindow();
const parent = settingsWindowParent();
if (parent && window.getParentWindow() !== parent) {
window.setParentWindow(parent);
}
await revealWindow(window);
}
function settingsWindowParent(): ElectronBrowserWindow | undefined {
if (process.platform !== "win32") {
return undefined;
}
return currentMainWindow() ?? undefined;
}
function rendererURL(): string | null {
return process.env.ELECTRON_RENDERER_URL ?? null;
}
@@ -598,6 +609,7 @@ async function createSettingsWindow(): Promise<ElectronBrowserWindow> {
const initial = SETTINGS_WINDOW_SIZE;
const backgroundColor = nativeTheme.shouldUseDarkColors ? "#15191a" : "#f2f4f7";
const window = new BrowserWindow({
parent: settingsWindowParent(),
width: initial.width,
height: initial.height,
minWidth: initial.minWidth,