Skip to content

feat: hide main window on Cmd+W and restore on reopen#241

Merged
Dimillian merged 5 commits intoDimillian:mainfrom
jmcte:jmcte/codex/cmdw-hide
Jan 26, 2026
Merged

feat: hide main window on Cmd+W and restore on reopen#241
Dimillian merged 5 commits intoDimillian:mainfrom
jmcte:jmcte/codex/cmdw-hide

Conversation

@jmcte
Copy link
Copy Markdown
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

codex-monitor@0.7.23 lint
eslint . --ext .ts,.tsx

codex-monitor@0.7.23 typecheck
tsc --noEmit

Fixes #240

@jmcte
Copy link
Copy Markdown
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
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: 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".

Comment thread src-tauri/src/lib.rs
@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
Copy Markdown
Owner

@codex review

@Dimillian Dimillian merged commit 00e05bb into Dimillian:main Jan 26, 2026
5 checks passed
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: 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 thread src-tauri/src/lib.rs
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();
Copy link
Copy Markdown

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 👍 / 👎.

@jmcte jmcte deleted the jmcte/codex/cmdw-hide branch January 30, 2026 23:25
gersmann pushed a commit to gersmann/codex-monitor-web that referenced this pull request Mar 10, 2026
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
zip700 pushed a commit to zip700/CodexMonitor that referenced this pull request Apr 3, 2026
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
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