Skip to content

fix(tray): left-click tray icon opens main window directly on Windows#1632

Closed
MarkSunDev wants to merge 1 commit intofarion1231:mainfrom
MarkSunDev:fix/tray-left-click-open-window
Closed

fix(tray): left-click tray icon opens main window directly on Windows#1632
MarkSunDev wants to merge 1 commit intofarion1231:mainfrom
MarkSunDev:fix/tray-left-click-open-window

Conversation

@MarkSunDev
Copy link
Copy Markdown

Problem

On Windows, left-clicking the system tray icon shows the context menu — same behavior as right-click. To open the main window, users must click the tray icon and then click "Open main window" from the menu, which is an unnecessary extra step.

Solution

  • Set show_menu_on_left_click(false) to disable menu popup on left-click
  • Handle MouseButton::Left + MouseButtonState::Up in on_tray_icon_event to show and focus the main window directly
  • Right-click behavior (context menu) remains unchanged

Testing

  • Left-click tray icon → main window shows and receives focus
  • Right-click tray icon → context menu opens as before
  • "Open main window" menu item still works correctly
  • macOS and Linux behavior unaffected (set_skip_taskbar is #[cfg(target_os = "windows")])

@farion1231
Copy link
Copy Markdown
Owner

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d263c66d19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/lib.rs
tray::handle_tray_menu_event(app, &event.id.0);
})
.show_menu_on_left_click(true);
.show_menu_on_left_click(false);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate left-click tray behavior to Windows only

This change makes show_menu_on_left_click(false) unconditional, so macOS/Linux also lose the previous left-click menu behavior and are routed through the new click handler. That is a cross-platform regression: on macOS, left-click now bypasses the existing show_main menu path in tray::handle_tray_menu_event that restores normal app visibility policy (apply_tray_policy(app, true)), so users coming from tray/accessory mode can get inconsistent activation/dock behavior. Scope this override to Windows (or keep left-click menu enabled on non-Windows) to preserve prior behavior.

Useful? React with 👍 / 👎.

@MarkSunDev MarkSunDev closed this by deleting the head repository Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants