Skip to content

feat(desktop): add ElectronTray service - #10162

Closed
SXP-Simon wants to merge 1 commit into
pingdotgg:mainfrom
SXP-Simon:feat/desktop-electron-tray
Closed

SXP-Simon wants to merge 1 commit into
pingdotgg:mainfrom
SXP-Simon:feat/desktop-electron-tray

Conversation

@SXP-Simon

@SXP-Simon SXP-Simon commented Sep 5, 2026

Copy link
Copy Markdown

Part of stacked PR resolving #10161.

Stacked PR Chain


Summary

Introduces the foundational ElectronTray service wrapping Electron's native Tray API for desktop platforms.

  • Provides type-safe tray creation, menu building (with exactOptionalPropertyTypes compatibility), and clean destruction.
  • Adds comprehensive unit tests with mocked Electron Tray instances.

Note

Add ElectronTray service for Electron tray management

  • Adds an Effect Context service in ElectronTray.ts exposing tray create and destroy operations, with creation errors wrapped as ElectronTrayCreateError and operation errors as ElectronTrayOperationError
  • create replaces any existing managed tray, builds a native image from the icon path (path as fallback), applies optional tooltip/context menu, registers click and double-click listeners, and stores the tray reference
  • destroy is idempotent for already-destroyed trays and converts thrown destruction failures into ElectronTrayOperationError via orDie
  • Registers ElectronTray.layer in the merged Electron layer in main.ts and adds a full test suite in ElectronTray.test.ts
📊 Macroscope summarized ed597df. 2 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

@github-actions github-actions Bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Sep 5, 2026
@github-actions github-actions Bot added the size:L 100-499 changed lines (additions + deletions). label Sep 5, 2026

export interface ElectronTrayMenuItem {
readonly label?: string;
readonly type?: "normal" | "separator" | "submenu" | "checkbox" | "radio";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium electron/ElectronTray.ts:38

ElectronTrayMenuItem advertises type: "submenu", but callers cannot provide any submenu entries, so selecting that type creates an empty submenu and nested tray actions cannot be implemented. Add a recursive submenu/children field and map it to MenuItemConstructorOptions.submenu when building the template.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/desktop/src/electron/ElectronTray.ts around line 38:

`ElectronTrayMenuItem` advertises `type: "submenu"`, but callers cannot provide any submenu entries, so selecting that type creates an empty submenu and nested tray actions cannot be implemented. Add a recursive `submenu`/children field and map it to `MenuItemConstructorOptions.submenu` when building the template.

@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a new production ElectronTray component covering native tray creation, menus, events, and lifecycle management; even without a current call site, that is a substantive new capability rather than a small isolated change. An unresolved Medium finding also notes that the advertised submenu type cannot represent nested tray actions.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@SXP-Simon

Copy link
Copy Markdown
Author

Closing this intermediate PR in favor of #10163, which contains the complete, self-contained implementation with system tray support and window lifecycle management.

@SXP-Simon SXP-Simon closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant