Skip to content

feat: auto-select screen based on cursor position for recording#67

Open
AnKh99 wants to merge 1 commit into
KartikLabhshetwar:mainfrom
AnKh99:feature/auto-select-screen
Open

feat: auto-select screen based on cursor position for recording#67
AnKh99 wants to merge 1 commit into
KartikLabhshetwar:mainfrom
AnKh99:feature/auto-select-screen

Conversation

@AnKh99

@AnKh99 AnKh99 commented Jun 8, 2026

Copy link
Copy Markdown

Description

This PR implements automatic screen selection based on the mouse cursor location for both full-screen and area (region) recording.

Why is this needed?

Previously, ScreenRecordingManager defaulted to recording the first display in SCShareableContent.displays (content.displays.first), which:

  1. Always recorded the primary screen during full-screen recording, even if the user wanted to record a secondary display.
  2. Caused area recording to map coordinates incorrectly when selecting a region on a secondary screen (because it calculated boundaries relative to NSScreen.screens.first).

Key Changes

  1. RegionSelectionOverlay.swift:
    • Updated the RegionSelection struct to capture and pass the target display's CGDirectDisplayID using the selected screen's device description.
  2. ScreenRecordingManager.swift:
    • Full-Screen Recording: Added detection of the screen containing the current mouse cursor (NSEvent.mouseLocation) to automatically record the active screen.
    • Area Recording: Used the selected screen's displayID to filter the correct display and dynamically mapped the area coordinates relative to that screen's frame in the Quartz coordinate system.

How to test

  1. Connect a secondary display (or use a virtual screen setup).
  2. Start Full Screen Recording with your cursor placed on the secondary display — it will record the secondary display.
  3. Start Area Recording, draw a frame on the secondary display, and confirm the captured video correctly matches the selected boundary on the secondary screen.

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the knox projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant