You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(desktop): minimizing the main window on Windows hides it to the tray - #188
The main window had close and closed handlers but no minimize handler, so minimizeToTray was never read. I added one: on Windows, if the preference is on (it defaults to true), the minimized window is hidden, so it leaves the taskbar. Clicking the tray icon or "Open Console" already goes through createOrShowMainWindow(), which restores and shows it, so nothing else needed to change.
macOS is left as it was, since the issue is about Windows and minimizing to the Dock is normal there.
Validation
Tested by hand on Windows 11 (10.0.26200) with electron-forge start. Before: the minimized window stayed on the taskbar. After: it disappears from the taskbar and comes back from the tray icon.
Added 3 tests to tests/main/window-manager.test.ts (preference on, preference off, macOS). The first two fail on main.
pnpm test in apps/desktop: 1461 passed, 6 failed. The 6 failures are in app-launch.test.ts and shortcut-manager-unassign.test.ts and fail the same way on main on my machine (ERR_MODULE_NOT_FOUND with a file:///C:/C:/... path), so they look like a Windows path issue in those tests rather than something from this change.
type:check passes, prettier --check and eslint are clean for the changed files.
One note: the "Minimize to tray" switch in Preferences is still commented out, so users can't turn this off from the UI. I didn't touch it since it looked intentional, but I can re-enable it here if you'd like.
Summary by CodeRabbit
New Features
On Windows, the main window can be hidden to the tray when minimized, based on the corresponding preference. When this preference is off, minimizing leaves the window visible.
Bug Fixes
Restoring a window hidden to the tray makes it visible again and clears its minimized state. On macOS, minimizing does not query this Windows-specific preference or hide the window.
No actionable comments were generated in the recent review.
Walkthrough
On Windows, minimizing the main window now checks the minimizeToTray preference. When enabled and the window is still minimized, the handler hides it. Tests cover preference settings, reopening the window, and non-Windows behavior.
Changes: Main-window minimize behavior
Layer / File(s)
Summary
Minimize handling and validation apps/desktop/src/main/core/window-manager.ts, apps/desktop/tests/main/window-manager.test.ts
The minimize event invokes a handler that checks the preference on Windows and hides the window when enabled and still minimized. Tests cover both preference settings, reopening the window, and non-Windows behavior.
Windows users can minimize to the tray and reopen the window. No merge-blocking issue was identified.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: minimizing the main window on Windows hides it to the tray. The raw summary confirms a minimize handler in window-manager.ts that calls hideMinimizedMainWindowToTray. …
Linked Issues check
Issue #178 requires three coding behaviors on Windows. (1) When minimizeToTray is enabled, minimizing the main window hides it from the taskbar. (2) The app stays running and reachable from the tray i…
Out of Scope Changes check
The PR summary lists two changed files. apps/desktop/src/main/core/window-manager.ts adds the minimize listener and the hideMinimizedMainWindowToTray helper. This directly implements #178. apps/deskto…
Docstring Coverage
Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Title check
Explanation
The title names the main change: minimizing the main window on Windows hides it to the tray. The raw summary confirms a minimize handler in window-manager.ts that calls hideMinimizedMainWindowToTray. It applies only on Windows and only when minimizeToTray is enabled. The PR objectives describe the same behavior and tie it to issue #178. The title uses the conventional fix(desktop) prefix and stays under 72 characters.
Full details: Linked Issues check
Explanation
Issue #178 requires three coding behaviors on Windows. (1) When minimizeToTray is enabled, minimizing the main window hides it from the taskbar. (2) The app stays running and reachable from the tray icon. (3) The tray "Open Console" action restores the window. At head, WindowManager.createOrShowMainWindow() registers mainWindow.on("minimize") and calls hideMinimizedMainWindowToTray(). That helper returns on non-win32 platforms. On win32 it reads getPreferences().minimizeToTray and calls window.hide() only when the window is alive and minimized. Errors are logged. For (2) and (3), tray-manager.ts at head routes both the tray click/double-click and the "Open Console" menu item to windowManager.createOrShowMainWindow(). That path restores a minimized window, then calls show() and focus() on the existing window. The commented-out Preferences switch is not a coding requirement of #178. The diff tool was unavailable, so the incremental change since the previous head was not read directly. The conclusion rests on the head file contents and the tray flow, which still satisfy the issue requirements.
Full details: Out of Scope Changes check
Explanation
The PR summary lists two changed files. apps/desktop/src/main/core/window-manager.ts adds the minimize listener and the hideMinimizedMainWindowToTray helper. This directly implements #178. apps/desktop/tests/main/window-manager.test.ts adds window-manager tests for the Windows preference-on, preference-off, and macOS cases. These tests support the implementation. The head file shows no unrelated behavior changes in the minimize path. The macOS path stays unchanged, as the PR objective states. The full-PR diff could not be read, so the changed-file list relies on the supplied summary and the head file contents. No unrelated change was demonstrated.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
apps/desktop/src/main/core/window-manager.ts
ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: b426d537-18de-4dd9-9bea-f6e7b3f9a0b3
Commits
Reviewing files that changed from the base of the PR and between adb8efc and 5f5ea51.
Files selected for processing: 1
apps/desktop/src/main/core/window-manager.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #178
Summary
The main window had
closeandclosedhandlers but nominimizehandler, sominimizeToTraywas never read. I added one: on Windows, if the preference is on (it defaults totrue), the minimized window is hidden, so it leaves the taskbar. Clicking the tray icon or "Open Console" already goes throughcreateOrShowMainWindow(), which restores and shows it, so nothing else needed to change.macOS is left as it was, since the issue is about Windows and minimizing to the Dock is normal there.
Validation
electron-forge start. Before: the minimized window stayed on the taskbar. After: it disappears from the taskbar and comes back from the tray icon.tests/main/window-manager.test.ts(preference on, preference off, macOS). The first two fail onmain.pnpm testinapps/desktop: 1461 passed, 6 failed. The 6 failures are inapp-launch.test.tsandshortcut-manager-unassign.test.tsand fail the same way onmainon my machine (ERR_MODULE_NOT_FOUNDwith afile:///C:/C:/...path), so they look like a Windows path issue in those tests rather than something from this change.type:checkpasses,prettier --checkandeslintare clean for the changed files.One note: the "Minimize to tray" switch in Preferences is still commented out, so users can't turn this off from the UI. I didn't touch it since it looked intentional, but I can re-enable it here if you'd like.
Summary by CodeRabbit