From 43d0a50c1dfc56528f4941d2465e4b404aa101cc Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 25 May 2026 14:01:01 -0700 Subject: [PATCH] [eric] win: create app shortcut on Squirrel install (was only Setup.exe visible) --- electron/main.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/electron/main.js b/electron/main.js index 13162298..983a47b0 100644 --- a/electron/main.js +++ b/electron/main.js @@ -39,15 +39,31 @@ if (process.argv.includes('--prewarm') && process.platform === 'win32') { process.exit(0); } +// Squirrel hands shortcut creation to the app: when we intercept --squirrel-* +// ourselves, Update.exe won't make the Start Menu / Desktop icons unless we ask +// it to. Skip this and the user only ever sees Setup.exe, no app to click. +function _squirrelUpdate(args) { + try { + const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe'); + const exeName = path.basename(process.execPath); + execFileSync(updateExe, [...args, exeName], { timeout: 20000, stdio: 'ignore', windowsHide: true }); + } catch (_) {} +} + // Squirrel.Windows lifecycle: app is invoked with --squirrel-* args during install/update/uninstall. Handle and exit fast; --squirrel-firstrun is the only one we let fall through to normal boot. (function handleSquirrelEvents() { if (process.platform !== 'win32' || process.argv.length < 2) return; const sq = process.argv[1]; if (sq === '--squirrel-install' || sq === '--squirrel-updated') { + _squirrelUpdate(['--createShortcut']); _squirrelPrewarmTouch(); process.exit(0); } - if (sq === '--squirrel-uninstall' || sq === '--squirrel-obsolete') { + if (sq === '--squirrel-uninstall') { + _squirrelUpdate(['--removeShortcut']); + process.exit(0); + } + if (sq === '--squirrel-obsolete') { process.exit(0); } })();