Skip to content

Conversation

@jmcte
Copy link
Contributor

@jmcte jmcte commented Jan 26, 2026

Summary

  • Prevent the main window from closing on Cmd+W and hide it instead.
  • Restore/focus the main window when the app is reopened (dock click, app reopen).
  • Ensure menu-triggered events show/focus the window before emitting.

Testing

[email protected] lint
eslint . --ext .ts,.tsx

[email protected] typecheck
tsc --noEmit

Fixes #240

@jmcte
Copy link
Contributor Author

jmcte commented Jan 26, 2026

Note: This follows the typical macOS pattern where Cmd+W hides/closes the window but keeps the app running, so reopening via the dock/menu restores the UI without losing session state.

Copy link

@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: dad99b1008

ℹ️ 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".

@Dimillian Dimillian changed the title Hide main window on Cmd+W and restore on reopen feat: hide main window on Cmd+W and restore on reopen Jan 26, 2026
@Dimillian
Copy link
Owner

@codex review

@Dimillian Dimillian merged commit 00e05bb into Dimillian:main Jan 26, 2026
5 checks passed
Copy link

@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: f8fe26af85

ℹ️ 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 on lines +159 to +163
app.run(|app_handle, event| {
if let RunEvent::Reopen { .. } = event {
if let Some(window) = app_handle.get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();

Choose a reason for hiding this comment

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

P1 Badge Guard mac-only RunEvent::Reopen usage

On Linux/Windows builds, RunEvent::Reopen is not available because Tauri gates that enum variant behind #[cfg(target_os = "macos")]. As written, this if let RunEvent::Reopen { .. } = event match will fail to compile on non-mac targets, breaking cross-platform builds. Consider wrapping the reopen handler in a #[cfg(target_os = "macos")] block or using a cfg-guarded helper.

Useful? React with 👍 / 👎.

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.

Cmd+W closes app; should hide window and allow reopen/reconnect

2 participants