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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"dependencies": {
"electron-log": "5.4.4",
"electron-menubar": "10.1.3",
"electron-menubar": "10.1.4",
"electron-updater": "6.8.9",
"react": "19.2.8",
"react-dom": "19.2.8",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ allowBuilds:
catalog:
electron: '43.2.0'
# Adopt this freshly published, first-party release ahead of pnpm's default
# minimumReleaseAge gate; it carries the Windows tray click fix (#3064).
# minimumReleaseAge gate; it carries the macOS dock icon fix (#3069).
minimumReleaseAgeExclude:
- electron-menubar@10.1.3
- electron-menubar@10.1.4
overrides:
react-is: '19.2.8'
# Force patched versions of transitive dev-tooling deps pulled in by
Expand Down
24 changes: 23 additions & 1 deletion src/main/lifecycle/first-run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ vi.mock('node:fs', () => ({
const moveToApplicationsFolderMock = vi.fn();
const isInApplicationsFolderMock = vi.fn(() => false);
const getPathMock = vi.fn(() => '/User/Data');
const dockHideMock = vi.fn();

const showMessageBoxMock = vi.fn(async () => ({
response: 0,
Expand All @@ -30,7 +31,15 @@ vi.mock('electron', () => ({
getPath: () => getPathMock(),
isInApplicationsFolder: () => isInApplicationsFolderMock(),
moveToApplicationsFolder: () => moveToApplicationsFolderMock(),
} satisfies Pick<Electron.App, 'getPath' | 'isInApplicationsFolder' | 'moveToApplicationsFolder'>,
dock: {
hide: () => dockHideMock(),
},
} satisfies Pick<
Electron.App,
'getPath' | 'isInApplicationsFolder' | 'moveToApplicationsFolder'
> & {
dock: { hide: () => void };
},
dialog: {
showMessageBox: () => showMessageBoxMock(),
} satisfies Pick<Electron.Dialog, 'showMessageBox'>,
Expand Down Expand Up @@ -125,6 +134,19 @@ describe('main/lifecycle/first-run', () => {
expect(moveToApplicationsFolderMock).not.toHaveBeenCalled();
});

it('re-hides the dock icon after the prompt closes (#3069)', async () => {
existsSyncMock.mockReturnValueOnce(false);
existsSyncMock.mockReturnValueOnce(false);
showMessageBoxMock.mockResolvedValueOnce({
response: 1,
checkboxChecked: false,
});

await onFirstRunMaybe();

expect(dockHideMock).toHaveBeenCalled();
});

it('does not prompt on non-macOS', async () => {
mac = false;
existsSyncMock.mockReturnValueOnce(false);
Expand Down
4 changes: 4 additions & 0 deletions src/main/lifecycle/first-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ async function promptMoveToApplicationsFolder() {
message: 'Move to Applications Folder?',
});

// Parentless dialogs pull a dock-hidden (accessory) app into the Dock and
// macOS does not restore the accessory policy on close; re-hide (#3069).
app.dock?.hide();

if (response === 0) {
app.moveToApplicationsFolder();
}
Expand Down
24 changes: 23 additions & 1 deletion src/main/updater.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dialog } from 'electron';
import { app, dialog } from 'electron';
import type { Menubar } from 'electron-menubar';

import { APPLICATION } from '../shared/constants';
Expand Down Expand Up @@ -45,6 +45,11 @@ vi.mock('electron', () => {
}
}
return {
app: {
dock: {
hide: vi.fn(),
},
},
dialog: {
showMessageBox: vi.fn(),
} satisfies Pick<Electron.Dialog, 'showMessageBox'>,
Expand Down Expand Up @@ -139,6 +144,23 @@ describe('main/updater.ts', () => {

expect(autoUpdater.quitAndInstall).toHaveBeenCalled();
});

it('re-hides the dock icon when user dismisses the dialog (#3069)', async () => {
vi.mocked(dialog.showMessageBox).mockResolvedValue({
response: 1, // "Later" button index
checkboxChecked: false,
});

await updater.start();

emit('update-downloaded', { releaseName: 'v9.9.9' });

// Allow then() of showMessageBox promise to resolve
await Promise.resolve();

expect(autoUpdater.quitAndInstall).not.toHaveBeenCalled();
expect(app.dock?.hide).toHaveBeenCalled();
});
});

describe('update event handlers & scheduling', () => {
Expand Down
9 changes: 8 additions & 1 deletion src/main/updater.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dialog, type MessageBoxOptions } from 'electron';
import { app, dialog, type MessageBoxOptions } from 'electron';
import type { Menubar } from 'electron-menubar';
import { autoUpdater } from 'electron-updater';

Expand Down Expand Up @@ -200,7 +200,14 @@ export default class AppUpdater {
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
autoUpdater.quitAndInstall();
return;
}

// Presenting a parentless dialog forces a dock-hidden (accessory) macOS
// app to activate into the Dock, and the accessory policy is not
// restored when the dialog closes. Re-assert it so the dock icon
// disappears again (#3069).
app.dock?.hide();
});
}
}