mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 03:54:08 +00:00
The setup launcher had no LSUIElement, and its already-installed hand-off ran after Tauri/AppKit, whose default activation policy is Regular. That registered the setup bundle as a second Dock app beside the real desktop. Hand off before constructing Tauri, and restore Regular activation only when the installer UI is actually shown. On macOS the Electron single-instance lock also ran before deep-link registration. setAsDefaultProtocolClient relaunches the app through Launch Services, so the loser already had a Dock icon by the time the lock failed and app.exit(0) ran. Register the protocol first. The lock-losing instance still hard-exits before ready. Fixes #73151
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
/**
|
|
* Order of the two startup steps that decide whether macOS shows a second
|
|
* Dock icon.
|
|
*
|
|
* On macOS, `setAsDefaultProtocolClient` goes through Launch Services. If the
|
|
* single-instance lock has already claimed this process, that registration
|
|
* relaunches a second instance. The loser already has a Dock icon by the time
|
|
* `requestSingleInstanceLock` fails and `app.exit(0)` runs, so the deep link
|
|
* is registered before the lock.
|
|
*
|
|
* Other platforms have no Dock. They still take the lock at module load so a
|
|
* second `hermes://` launch arrives as `second-instance` argv, and they
|
|
* register the protocol on ready.
|
|
*/
|
|
|
|
export type DockLaunchStep = 'register-deep-link' | 'single-instance-lock'
|
|
|
|
export function preReadyDockLaunchSteps(platform: string): DockLaunchStep[] {
|
|
if (platform === 'darwin') {
|
|
return ['register-deep-link', 'single-instance-lock']
|
|
}
|
|
|
|
return ['single-instance-lock']
|
|
}
|
|
|
|
/** True when protocol registration is a pre-ready step that precedes the lock. */
|
|
export function deepLinkRegistersBeforeSingleInstanceLock(platform: string): boolean {
|
|
const steps = preReadyDockLaunchSteps(platform)
|
|
const registerAt = steps.indexOf('register-deep-link')
|
|
const lockAt = steps.indexOf('single-instance-lock')
|
|
|
|
return registerAt !== -1 && lockAt !== -1 && registerAt < lockAt
|
|
}
|