diff --git a/frontend/electron/main.ts b/frontend/electron/main.ts index 215e173..ec1df1c 100644 --- a/frontend/electron/main.ts +++ b/frontend/electron/main.ts @@ -506,9 +506,18 @@ ipcMain.handle('switch-account', async (event, loginName: string) => await handl ipcMain.handle('open-external', (event, url: string) => shell.openExternal(url)); ipcMain.handle('open-steam-app-login', async () => { - console.log('[SteamClient] Triggering desktop login window...'); - // Force Steam to show login window. - // steam://open/login is the protocol for this. + console.log('[SteamClient] Preparing for fresh login...'); + await killSteam(); + + if (process.platform === 'win32') { + // Clear auto-login registry + const clearReg = 'reg add "HKCU\\Software\\Valve\\Steam" /v AutoLoginUser /t REG_SZ /d "" /f'; + await new Promise((res) => exec(clearReg, () => res())); + } else if (process.platform === 'linux') { + // On Linux we can use the steamClient helper to set an empty user + await steamClient.setAutoLoginUser("", undefined, ""); + } + const command = process.platform === 'win32' ? 'start steam://open/login' : 'xdg-open steam://open/login'; exec(command); return true;