Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Jan 5, 2026

fix #1243

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed coordinate calculation when dragging tabs outside the window to create new windows—now uses screen coordinates for accurate positioning.
  • Improvements

    • Enhanced macOS tooltip overlay visibility management and workspace behavior.
    • Improved window handling and display logic for tabs moved between windows.
    • Removed automatic DevTools opening in development mode for a cleaner experience.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

The changes refactor tab movement to new windows and window creation. They remove automatic DevTools opening for tabs, add a forMovedTab flag to control window visibility when tabs are dragged to new windows, update drag coordinates from client-relative to screen-relative, and implement macOS-specific tooltip overlay visibility and workspace handling.

Changes

Cohort / File(s) Summary
Tab Creation & DevTools
src/main/presenter/tabPresenter.ts
Removed automatic DevTools opening logic for new tabs in development mode. DevTools no longer open in detach mode for non-browser windows after URL loads.
Window Creation & Tooltip Overlay Management
src/main/presenter/windowPresenter/index.ts
Added forMovedTab optional flag to createShellWindow options to show browser-type windows when tabs are dragged to new locations. Updated shouldAutoShow logic to respect this flag. Enhanced macOS tooltip overlay behavior: configured overlays to hide in Mission Control, show on all workspaces, and manage visibility state during lifecycle events (load, show, hide, clear) to avoid redundant state changes. Added guards for Darwin-specific overlay configuration.
Tab Drag Coordinates
src/renderer/shell/components/AppBar.vue
Changed moveTabToNewWindow call in handleDragEnd to use screenX and screenY instead of clientX and clientY, converting drag coordinates to screen-relative positioning. Updated method signature accordingly.

Sequence Diagram

sequenceDiagram
    actor User
    participant AppBar as Renderer: AppBar
    participant TabPresenter as Main: tabPresenter
    participant WindowPresenter as Main: windowPresenter
    participant Shell as Shell Window
    
    User->>AppBar: Drag tab outside window
    AppBar->>AppBar: handleDragEnd triggered
    AppBar->>TabPresenter: moveTabToNewWindow(tabId, screenX, screenY)
    
    TabPresenter->>WindowPresenter: createShellWindow({<br/>forMovedTab: true,<br/>x: screenX, y: screenY<br/>})
    
    rect rgb(200, 220, 255)
        Note over WindowPresenter: Window Creation
        WindowPresenter->>WindowPresenter: shouldAutoShow = true<br/>(forMovedTab bypasses type check)
        WindowPresenter->>Shell: Create window at screen position
        Shell->>WindowPresenter: ready-to-show
    end
    
    rect rgb(220, 240, 220)
        Note over WindowPresenter: macOS Overlay Setup
        WindowPresenter->>WindowPresenter: Configure tooltip overlay<br/>(hidden in Mission Control,<br/>visible on all workspaces)
    end
    
    WindowPresenter->>Shell: showInactive() if needed
    Shell-->>User: New window with tab visible
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A tab takes flight, dragged with care,
From screen coords now, coordinates fair,
New windows bloom where dropped they land,
The overlay hides, obeys our command,
DevTools rest while rabbits prance in glee! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: macos full screen error' is vague and does not clearly describe the actual changes. The PR involves tab dragging, window creation, tooltip overlay management, and coordinate system adjustments, but the title only hints at a macOS issue without explaining what was actually fixed. Consider a more descriptive title that explains the core changes, such as 'fix: use screen coordinates for moved tabs on macOS' or 'fix: improve tooltip overlay visibility on macOS'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

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
Contributor

@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.

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @src/main/presenter/tabPresenter.ts:
- Line 219: Translate the Chinese comment "// DevTools 不再自动打开(避免在 macOS
全屏时产生额外窗口/空间的异常体验)" to clear English, e.g. "// DevTools no longer open
automatically to avoid creating extra windows/spaces when macOS is fullscreen",
and replace the original comment in tabPresenter.ts; also add a short follow-up
note (same comment block) that developers can open DevTools manually via the
menu or shortcut (F12 / Cmd+Option+I) to ensure the development workflow is
clear.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b744c11 and 1813065.

📒 Files selected for processing (3)
  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
  • src/renderer/shell/components/AppBar.vue
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for logs and comments in TypeScript/JavaScript code

Files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use TypeScript with strict type checking enabled

Use OxLint for linting JavaScript and TypeScript files; ensure lint-staged hooks and typecheck pass before commits

Files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/main/presenter/**/*.ts: Use EventBus to broadcast events from main to renderer via mainWindow.webContents.send()
Implement one presenter per functional domain in the main process

Files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
src/main/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/main/**/*.ts: Use EventBus from src/main/eventbus.ts for decoupled inter-process communication
Context isolation must be enabled with preload scripts for secure IPC communication

Electron main process code should reside in src/main/, with presenters organized in presenter/ subdirectory (Window, Tab, Thread, Mcp, Config, LLMProvider), and app events managed via eventbus.ts

Files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
**/*.{js,ts,tsx,jsx,vue,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

All logs and comments must be in English

Files:

  • src/main/presenter/tabPresenter.ts
  • src/renderer/shell/components/AppBar.vue
  • src/main/presenter/windowPresenter/index.ts
**/*.{js,ts,tsx,jsx,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Use OxLint as the linter

Files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
**/*.{js,ts,tsx,jsx,vue,json,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Use Prettier as the code formatter

Files:

  • src/main/presenter/tabPresenter.ts
  • src/renderer/shell/components/AppBar.vue
  • src/main/presenter/windowPresenter/index.ts
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,vue}: Use camelCase for variable and function names; use PascalCase for types and classes; use SCREAMING_SNAKE_CASE for constants
Configure Prettier with single quotes, no semicolons, and line width of 100 characters. Run pnpm run format after completing features

Files:

  • src/main/presenter/tabPresenter.ts
  • src/renderer/shell/components/AppBar.vue
  • src/main/presenter/windowPresenter/index.ts
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: Use Vue 3 Composition API for all components
Use Tailwind CSS for styling with scoped styles
All user-facing strings must use i18n keys via vue-i18n

Files:

  • src/renderer/shell/components/AppBar.vue
src/renderer/shell/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

Shell UI code should be located in src/renderer/shell/

Files:

  • src/renderer/shell/components/AppBar.vue
**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

Vue components must be named in PascalCase (e.g., ChatInput.vue) and use Vue 3 Composition API with Pinia for state management and Tailwind for styling

Files:

  • src/renderer/shell/components/AppBar.vue
🧠 Learnings (6)
📚 Learning: 2025-06-21T15:48:29.950Z
Learnt from: neoragex2002
Repo: ThinkInAIXYZ/deepchat PR: 550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.

Applied to files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
📚 Learning: 2026-01-05T02:41:31.619Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-stack-guide.mdc:0-0
Timestamp: 2026-01-05T02:41:31.619Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Use `usePresenter` composable for main process communication instead of direct IPC calls

Applied to files:

  • src/main/presenter/tabPresenter.ts
📚 Learning: 2026-01-05T02:40:52.831Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-05T02:40:52.831Z
Learning: Applies to src/main/presenter/**/*.ts : Use EventBus to broadcast events from main to renderer via `mainWindow.webContents.send()`

Applied to files:

  • src/main/presenter/tabPresenter.ts
  • src/main/presenter/windowPresenter/index.ts
📚 Learning: 2026-01-05T02:40:52.831Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-05T02:40:52.831Z
Learning: Applies to src/main/presenter/**/*.ts : Implement one presenter per functional domain in the main process

Applied to files:

  • src/main/presenter/tabPresenter.ts
📚 Learning: 2026-01-05T02:40:52.831Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-05T02:40:52.831Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Use `usePresenter.ts` composable for renderer-to-main IPC communication via direct presenter method calls

Applied to files:

  • src/main/presenter/tabPresenter.ts
📚 Learning: 2026-01-05T02:41:45.204Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.204Z
Learning: Applies to src/main/**/*.ts : Electron main process code should reside in `src/main/`, with presenters organized in `presenter/` subdirectory (Window, Tab, Thread, Mcp, Config, LLMProvider), and app events managed via `eventbus.ts`

Applied to files:

  • src/main/presenter/windowPresenter/index.ts
⏰ 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). (1)
  • GitHub Check: build-check (x64)
🔇 Additional comments (7)
src/main/presenter/windowPresenter/index.ts (6)

676-687: LGTM: Well-documented new parameter for moved tab behavior.

The forMovedTab flag is a clean solution to distinguish user-initiated tab moves from programmatic browser window creation, ensuring proper visibility behavior.


774-791: LGTM: Correct auto-show logic for moved tabs.

The updated shouldAutoShow logic correctly prevents browser windows from stealing focus except when explicitly moved by the user via drag-and-drop. This addresses the focus management issues mentioned in the PR.


79-110: LGTM: Defensive visibility checks prevent redundant overlay operations.

The added checks ensure overlay.showInactive() is only called when the overlay is not already visible, preventing potential flickering or race conditions on macOS.


112-124: LGTM: Consistent visibility checks for hide operations.

The visibility guards before calling overlay.hide() mirror the pattern used for showInactive(), ensuring symmetric and safe overlay state management.


1105-1108: LGTM: macOS-specific overlay configuration addresses fullscreen issues.

The setHiddenInMissionControl(true) and setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }) settings ensure tooltip overlays work correctly across workspaces and in fullscreen mode on macOS, which directly addresses the PR's objective.


1177-1185: LGTM: Consistent visibility management in clearTooltipOverlay.

The visibility check before hiding the overlay follows the established pattern and ensures clean tooltip lifecycle management.

src/renderer/shell/components/AppBar.vue (1)

528-565: LGTM: Correct coordinate system for new window positioning.

The change from event.clientX, event.clientY to event.screenX, event.screenY is correct. When dragging a tab outside the window to create a new window, screen-absolute coordinates are needed to position the new window at the drop location, not viewport-relative coordinates.

@zerob13 zerob13 merged commit 8cc327f into dev Jan 6, 2026
2 checks passed
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] macos无法缩小页面

2 participants