Skip to content

Conversation

@waydabber
Copy link
Member

There was an issue regarding virtual displays (DisplayLink, Sidecar etc) - the app uses CGDirectDisplayID as a preference ID suffix alongside the display name and vendor/model number. Since on every connect this id is changing for these displays, MonitorControl could not track preferences associated to these displays (+ the preferences store was polluted with dead items as well). This is now fixed, we now use the system generated, permanent serial number as suffix for virtual displays. For real displays we continue to use CGDirectDisplayID as the serial number is often the same for identical displays which causes issues in multi-display configs with similar physical displays.

@waydabber
Copy link
Member Author

An other day, an other fix. Approve this one please. :) This is an addition to the bugfix release 4.0.2. Thanks!

@waydabber waydabber linked an issue Nov 16, 2021 that may be closed by this pull request
self.serialNumber = serialNumber
self.isVirtual = DEBUG_VIRTUAL ? true : isVirtual
self.isDummy = isDummy
self.prefsId = "(" + String(name.filter { !$0.isWhitespace }) + String(vendorNumber ?? 0) + String(modelNumber ?? 0) + "@" + (self.isVirtual ? String(self.serialNumber ?? 9999) : String(identifier)) + ")"
Copy link
Member

@JoniVR JoniVR Nov 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use string concatenation here instead? I think that might simplify this line quite a bit.

I haven't really tested it myself, because I don't really know how the virtual display feature is supposed to work, but will this handle me changing the name of the display without issues? Or is this name property a different one from the one the user can configure?

I think something like:

self.prefsId = "(\(name.filter { !$0.isWhitespace })\(vendorNumber ?? 0)\(modelNumber ?? 0)@\(self.isVirtual ? (self.serialNumber ?? 9999) : identifier))"

might do the trick, is imo a bit more concise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks nicer.

Yes, this name is a permanent one and different from friendlyName which was differentiated a while back.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed that line to look nice. Approve please! Thanks! :)

@waydabber waydabber merged commit 226f068 into master Nov 16, 2021
@waydabber waydabber deleted the fixes branch November 16, 2021 21:18
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.

Saving display specific settings do not work on virtual displays

3 participants