fix: don't always open main window on dock click#263
Conversation
When the screen-share window exists, focus on this one and don't open the main window.
✅ Deploy Preview for hoppdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe reopen handler for the app now prioritizes displaying a screenshare window when the application is reopened. If a screenshare window exists, it is shown and focused; otherwise, the handler falls back to showing the main window as previously implemented. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tauri/src-tauri/src/main.rs (1)
1116-1128: Logic looks correct for the PR objective.The change correctly prioritizes the screenshare window on dock click, falling back to the main window if no screenshare window exists.
One minor observation: the error log at line 1126 says "Main window not found" but at this point both screenshare and main windows were not found. Consider a more accurate message like "No focusable window found".
Also, given that
set_dock_icon_visible(lines 399-406) considerscameraandcontentPickerwindows alongsidescreenshare, should any of those also be considered for focus on reopen? If intentionally excluded, the current implementation is fine.💡 Optional: More accurate error message
let screenshare_window = app_handle.get_webview_window("screenshare"); if let Some(window) = screenshare_window { let _ = window.show(); let _ = window.set_focus(); } else { let main_window = app_handle.get_webview_window("main"); if let Some(window) = main_window { let _ = window.show(); let _ = window.set_focus(); } else { - log::error!("Main window not found"); + log::error!("No focusable window found (screenshare/main)"); } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tauri/src-tauri/src/main.rs` around lines 1116 - 1128, The current reopen logic checks screenshare_window then main_window but logs "Main window not found" even when both are missing; change the log::error! call to a more accurate message like "No focusable window found" (referencing screenshare_window, main_window and the existing log::error! invocation), and if desired expand the focus order to also query app_handle.get_webview_window("camera") and app_handle.get_webview_window("contentPicker") (prioritize screenshare -> camera -> contentPicker -> main) before logging so those windows can be focused on reopen.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tauri/src-tauri/src/main.rs`:
- Around line 1116-1128: The current reopen logic checks screenshare_window then
main_window but logs "Main window not found" even when both are missing; change
the log::error! call to a more accurate message like "No focusable window found"
(referencing screenshare_window, main_window and the existing log::error!
invocation), and if desired expand the focus order to also query
app_handle.get_webview_window("camera") and
app_handle.get_webview_window("contentPicker") (prioritize screenshare -> camera
-> contentPicker -> main) before logging so those windows can be focused on
reopen.
When the screen-share window exists, focus on this one and don't open the main window.
Closes #261
Summary by CodeRabbit