Skip to content

fix: don't always open main window on dock click#263

Merged
iparaskev merged 1 commit intomainfrom
fix_main_open
Mar 3, 2026
Merged

fix: don't always open main window on dock click#263
iparaskev merged 1 commit intomainfrom
fix_main_open

Conversation

@iparaskev
Copy link
Contributor

@iparaskev iparaskev commented Mar 3, 2026

When the screen-share window exists, focus on this one and don't open the main window.

Closes #261

Summary by CodeRabbit

  • Bug Fixes
    • When reopening the app with an active screenshare, the screenshare window is now prioritized and brought to focus instead of the main window.

When the screen-share window exists, focus on this one and don't
open the main window.
@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for hoppdocs ready!

Name Link
🔨 Latest commit c1d4a31
🔍 Latest deploy log https://app.netlify.com/projects/hoppdocs/deploys/69a6a04f35fb9900089247c3
😎 Deploy Preview https://deploy-preview-263--hoppdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Reopen handler logic
tauri/src-tauri/src/main.rs
Modified ReopenEvent handler to check for screenshare window existence first, then conditionally show and focus either the screenshare window or the main window as fallback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A screenshare appears, and the rabbit takes note,
"When reopening time comes, this window I'll quote!"
No more main-window-first, the new way is clear,
Prioritize sharing—the screen window's here!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: modifying the reopen/dock-click behavior to prioritize the screenshare window instead of always opening the main window.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_main_open

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 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) considers camera and contentPicker windows alongside screenshare, 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.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23e4153 and c1d4a31.

📒 Files selected for processing (1)
  • tauri/src-tauri/src/main.rs

@iparaskev iparaskev merged commit e11c22d into main Mar 3, 2026
19 checks passed
@iparaskev iparaskev deleted the fix_main_open branch March 3, 2026 09:10
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.

bug: Selecting share app opens menu tray

1 participant