-
Notifications
You must be signed in to change notification settings - Fork 991
Fix Target Select Overlay window bounds on multimonitor setups #1232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe window targeting overlay logic is simplified by removing intermediate computed state. The conditional gating now directly checks if the target is under the current display, and window content rendering directly uses Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes The changes involve careful logic simplification in a single file. Review should verify that the simplified conditionals maintain equivalent behavior and don't inadvertently alter window selection or display targeting functionality. Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/desktop/src/routes/target-select-overlay.tsx (1)
224-224: Simplified rendering logic - consider cleanup.The change to directly use
targetUnderCursor.windowsimplifies the rendering logic and aligns with the multimonitor fix.However, this makes the
selectedWindowquery (lines 69-90) and the fallback logic inwindowToShow()(lines 95-97) effectively unused, since the overlay now only renders when actively hovering over a window. Consider removing or refactoring this unused code to improve maintainability.Apply this diff to remove the unused query and simplify
windowToShow():- const selectedWindow = createQuery(() => ({ - queryKey: ["selectedWindow", rawOptions.captureTarget], - queryFn: async () => { - if (rawOptions.captureTarget.variant !== "window") return null; - const windowId = rawOptions.captureTarget.id; - - const windows = await commands.listCaptureWindows(); - const window = windows.find((w) => w.id === windowId); - - if (!window) return null; - - return { - id: window.id, - app_name: window.owner_name || window.name || "Unknown", - bounds: window.bounds, - }; - }, - enabled: - rawOptions.captureTarget.variant === "window" && - rawOptions.targetMode === "window", - staleTime: 5 * 1000, - })); - const windowToShow = () => { - const hoveredWindow = targetUnderCursor.window; - if (hoveredWindow) return hoveredWindow; - if (rawOptions.captureTarget.variant === "window") { - const selected = selectedWindow.data; - if (selected) return selected; - } - return hoveredWindow; + return targetUnderCursor.window; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/desktop/src/routes/target-select-overlay.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by runningpnpm format.Use strict TypeScript and avoid any; leverage shared types
Files:
apps/desktop/src/routes/target-select-overlay.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g.,user-menu.tsx).
Use PascalCase for React/Solid components.
Files:
apps/desktop/src/routes/target-select-overlay.tsx
apps/desktop/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/desktop/src/**/*.{ts,tsx}: Desktop icons are auto-imported (unplugin-icons); do not import icons manually
Desktop IPC: Call generated tauri_specta commands/events; listen to generated events and use typed interfaces
Use @tanstack/solid-query for server state in the desktop app
Files:
apps/desktop/src/routes/target-select-overlay.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/desktop/src/routes/target-select-overlay.tsx (1)
218-222: LGTM - Simplified multimonitor logic.The condition now directly checks if the cursor is over the current display, removing the composite logic that could cause the overlay to appear on incorrect displays. This should fix the multimonitor issues mentioned in the PR.
Reverts some changes introduced in #1104
Summary by CodeRabbit