Skip to content

DisplayIds from the module don't match the Ids in display settings #7

@MartinGC94

Description

@MartinGC94

Ideally the display IDs used by this module would mirror the IDs listed in display settings for a consistent user experience. Unfortunately I haven't been able to determine the logic they use to set the IDs so I've had to invent my own logic. The logic simply sorts by display adapter and then gives a custom priority number based on the connector type and connection instance number, prioritizing typical "PC" connection types over others. See: https://github.com/MartinGC94/DisplayConfig/blob/main/src/DisplayConfig/API/DisplayConfig.cs#L152

Methods I've tried:
1: The following registry keys seem promising in providing the data but they are not readable by a standard user so it's not a viable solution:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers\Configuration
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers\Connectivity

2: Sorting by the monitor UIDs listed in the device path like: \?\DISPLAY#LGD06B1#4&8bc03bf&0&UID8388688#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} the order was completely out of wack on all my test systems.

3: Simply going in the order of the paths returned by QueryDisplayConfig. Disabled paths are put after the live paths so disabling or enabling a display would make the ID assignments inconsistent. This is obviously bad.

4: The registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\monitor\Enum is readable but the order doesn't always line up with the settings app.

If someone happens to know the logic and can share it here I would be happy to try and implement it in the module. For now though, the custom priority logic I've come up with seems to get reasonably close on most systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions