Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
],
"category": "public.app-category.developer-tools",
"extendInfo": {
"LSUIElement": true,
"CFBundleAllowMixedLocalizations": true,
"CFBundleDevelopmentRegion": "en",
"CFBundleLocalizations": [
Expand Down
5 changes: 5 additions & 0 deletions apps/desktop/scripts/verify-workdsh-carrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export function normalizeAsarEntry(entry: string): string {
}

export async function afterPack(context: PackContext): Promise<void> {
if (context.electronPlatformName === 'darwin') {
const plist = join(context.appOutDir, `${context.packager.appInfo.productFilename}.app`, 'Contents', 'Info.plist')
const nativeRole = spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Print :LSUIElement', plist], { encoding: 'utf8' })
if (nativeRole.status !== 0 || nativeRole.stdout.trim() !== 'true') throw new Error('macOS carrier must start as a native UIElement before browser worker JavaScript runs')
}
const resources = context.electronPlatformName === 'darwin'
? join(context.appOutDir, `${context.packager.appInfo.productFilename}.app`, 'Contents', 'Resources')
: join(context.appOutDir, 'resources')
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/src/workdsh-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ const worker = browserWorkerRequest()
if (worker !== undefined) {
startBrowserWorker(worker)
} else {
// The native bundle starts without a Dock icon so spawned browser workers cannot
// flash one before JavaScript runs. Only the primary application becomes foreground.
if (process.platform === 'darwin') app.setActivationPolicy('regular')
const desktopUserData = process.env.WORKDSH_DESKTOP_USER_DATA
if (desktopUserData) {
if (!isAbsolute(desktopUserData)) throw new Error('Desktop user data override must be absolute')
Expand Down
5 changes: 4 additions & 1 deletion apps/desktop/tests/connection-lifecycle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ vi.mock('electron', async () => {
return {
BrowserWindow: Window,
ipcMain: { handle: (name: string, fn: any) => { state.handlers[name] = fn } },
app: Object.assign(new EventEmitter(), { setName: vi.fn(), requestSingleInstanceLock: () => true, whenReady: async () => {}, quit: vi.fn(), relaunch: vi.fn(), getPath: () => state.userData }),
app: Object.assign(new EventEmitter(), { setActivationPolicy: vi.fn(), setName: vi.fn(), requestSingleInstanceLock: () => true, whenReady: async () => {}, quit: vi.fn(), relaunch: vi.fn(), getPath: () => state.userData }),
shell: { openExternal: vi.fn() }, dialog: { showErrorBox: vi.fn(), showOpenDialog: vi.fn(async () => ({ canceled: true, filePaths: [] })) },
Menu: { buildFromTemplate: (menu: any[]) => { state.menu = menu; return menu }, setApplicationMenu: vi.fn() },
}
Expand Down Expand Up @@ -73,6 +73,9 @@ it('enforces the packaged backend, uses explicitly installed enterprise identity
})
try {
await import('../src/workdsh-main.ts')
const { app: startupApp } = await import('electron')
if (process.platform === 'darwin') expect(startupApp.setActivationPolicy).toHaveBeenCalledWith('regular')
else expect(startupApp.setActivationPolicy).not.toHaveBeenCalled()
await vi.waitFor(() => expect(state.windows).toHaveLength(1))
const entry = state.windows[0]
expect(decodeURIComponent(entry.url)).toContain('<p>https://company.test</p>')
Expand Down
Loading