Clarify screen capture availability probing#15
Open
ashish200729 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR replaces the periodic “screen sharing detection” logic with a safer “screen capture availability” probe (to avoid Linux/Wayland portal issues), and exposes the probe status via debug info.
Changes:
- Replaced
setupScreenSharingDetection()withsetupScreenCaptureAvailabilityWatcher()and a newcheckScreenCaptureAvailability()flow. - Added
screenCaptureStatus+ overlap-guard state (isCheckingScreenCaptureStatus) to track probe results and timing. - Updated logs and cleanup logic to reflect the new watcher.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| const sources = await desktopCapturer.getSources({ | ||
| await desktopCapturer.getSources({ | ||
| types: ['screen', 'window'], |
| if (previousAvailability === false) { | ||
| logger.debug('Screen capture enumeration still unavailable', logContext); | ||
| } else { | ||
| logger.warn('Screen capture enumeration unavailable; leaving screen sharing mode unchanged', logContext); |
Comment on lines
+867
to
+871
| this.screenCaptureStatus = { | ||
| available: false, | ||
| lastError: error.message, | ||
| lastCheckedAt: checkedAt | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clarifies the screen capture watcher so it no longer treats Electron's source enumeration as active screen sharing detection.
Electron's desktopCapturer.getSources() can confirm whether screen/window capture sources can be enumerated, but it does not reliably indicate whether another app is currently sharing the screen. This change makes that distinction explicit by tracking capture availability separately from screen sharing mode.
What Changed
Why
The previous implementation implied that desktopCapturer.getSources() detected active screen sharing. In practice, it only verifies that Electron can enumerate capture sources. Treating that probe as screen sharing detection could produce misleading state and confusing logs.
This keeps the existing screen sharing mode behavior intact while making the periodic probe accurate and observable.
Validation