Skip to content

fix: tray show opens main window on first click#147

Merged
mxyhi merged 1 commit intomainfrom
fix/main-window-first-click
Feb 25, 2026
Merged

fix: tray show opens main window on first click#147
mxyhi merged 1 commit intomainfrom
fix/main-window-first-click

Conversation

@mxyhi
Copy link
Owner

@mxyhi mxyhi commented Feb 25, 2026

Problem

When the main window has been hidden/destroyed, clicking tray "显示主窗口" the first time may only recreate the window object but not actually present it, so users have to click twice.

Root cause

The create path only built the window and synced menu state. Since tauri.conf.json sets visible: false, a newly created window can stay hidden unless we explicitly show/focus it.

Fix

  • In the create path of show_or_create_main_window, capture the newly built window
  • Explicitly call unminimize(), show(), and set_focus()
  • Keep menu sync after successful creation

Verification

  • cargo check -q -p token_proxy
  • cargo test -q -p token_proxy tray::tests

@mxyhi mxyhi merged commit 53aedbc into main Feb 25, 2026
1 check passed
@mxyhi mxyhi deleted the fix/main-window-first-click branch February 25, 2026 12:12
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.

1 participant