Skip to content

Commit ea7679c

Browse files
committed
Bring back removeDuplicates() by republishing on every display refresh
1 parent 8aa53a0 commit ea7679c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Brightness Sync/AppDelegate.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
172172
}
173173
}
174174
.switchToLatest()
175+
.removeDuplicates()
175176
.multicast(subject: PassthroughSubject())
176177

177178
// There is a quirk in CoreDisplay, that causes the builtin display to read a brightness value of 1.0 just after you closed the lid and enter clamshell mode.
@@ -239,12 +240,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
239240
let builtin = allDisplays.first { CGDisplayIsBuiltin($0) == 1 }
240241
let targets = allDisplays.filter { lgDisplayIdentifiers.contains(DisplayIdentifier(vendorNumber: CGDisplayVendorNumber($0), modelNumber: CGDisplayModelNumber($0))) }
241242

242-
if builtin != sourceDisplayPublisher.value {
243-
sourceDisplayPublisher.send(builtin)
244-
}
245-
if targets != targetDisplaysPublisher.value {
246-
targetDisplaysPublisher.send(targets)
247-
}
243+
sourceDisplayPublisher.send(builtin)
244+
targetDisplaysPublisher.send(targets)
248245
}
249246

250247
static let maxDisplays: UInt32 = 8

0 commit comments

Comments
 (0)