Skip to content

Feature Request: desktopCapturer.getSources() should return actual monitor names instead of generic "Screen 1", "Screen 2" #47793

@kaovilai

Description

@kaovilai

Preflight Checklist

Problem Description

Currently, when using desktopCapturer.getSources() to get available screens for screen sharing, Electron returns generic names like "Screen 1", "Screen 2", "Screen 3" for multiple monitors. This makes it difficult for users to identify which physical monitor they want to share, especially when they have multiple monitors of the same resolution.

This issue has been raised by users of applications like Deskreen (see pavlobu/deskreen#283) where the lack of descriptive monitor names creates a poor user experience.

Proposed Solution

Enhance the desktopCapturer.getSources() API to return actual monitor model names that help users identify their displays. For example:

  • "LG 27UK850" instead of "Screen 1"
  • "Dell U2720Q" instead of "Screen 2"
  • "MacBook Pro Built-in Display" instead of "Screen 3"

Implementation Approach

The implementation would require platform-specific code to query display information:

macOS: Use Core Graphics API

CFStringRef displayName = CGDisplayCopyDisplayName(displayID);

Windows: Use Windows Display Configuration API

DISPLAYCONFIG_TARGET_DEVICE_NAME targetName;
DisplayConfigGetDeviceInfo(&targetName);

Linux: Use X11/XRandR or Wayland protocols (implementation varies by display server)

The display names would be mapped to the existing display IDs returned by desktopCapturer.getSources().

Alternatives Considered

  1. Adding a new API: Create a separate API like screen.getDisplayNames() that returns a mapping of display IDs to friendly names. However, this would require developers to manually correlate the data.

  2. Optional parameter: Add an optional parameter to getSources() to request detailed display information. This maintains backward compatibility while providing the feature when needed.

Additional Information

  • This feature would significantly improve user experience in screen sharing scenarios
  • The implementation complexity varies by platform, with Linux being the most fragmented due to different display servers
  • This enhancement would benefit all Electron applications that use screen sharing functionality
  • Similar functionality exists in native applications on all major platforms

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions