From 82ffd6272354a498ebf1f87694d3237511539bd7 Mon Sep 17 00:00:00 2001 From: chyoo Date: Mon, 6 Jul 2026 13:52:22 +0900 Subject: [PATCH] fix launcher desktop registration and google login flow --- src/main/index.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index b96ed58..4f9e809 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -97,14 +97,19 @@ function registerLinuxProtocolHandler(): void { if (process.platform !== 'linux') return try { - const desktopFileName = is.dev - ? 'autonomy-studio-launcher-dev.desktop' - : 'autonomy-studio-launcher.desktop' const applicationsDir = join(app.getPath('home'), '.local', 'share', 'applications') + const installedDesktopFilePath = join(applicationsDir, 'autonomy-studio-launcher.desktop') + + if (!is.dev) { + rmSync(installedDesktopFilePath, { force: true }) + execFile('xdg-mime', ['default', 'autonomy-studio-launcher.desktop', 'x-scheme-handler/autonomy-studio'], () => undefined) + execFile('update-desktop-database', [applicationsDir], () => undefined) + return + } + + const desktopFileName = 'autonomy-studio-launcher-dev.desktop' const desktopFilePath = join(applicationsDir, desktopFileName) - const iconPath = is.dev - ? join(process.cwd(), 'resources/icon.png') - : join(dirname(process.execPath), 'resources/icon.png') + const iconPath = join(process.cwd(), 'resources/icon.png') const execArgs = process.defaultApp && process.argv[1] ? `"${escapeDesktopExecValue(process.execPath)}" "${escapeDesktopExecValue(resolve(process.argv[1]))}" %u` : `"${escapeDesktopExecValue(process.execPath)}" %u`