Skip to content

Commit 123b344

Browse files
committed
Formatting
1 parent 7889878 commit 123b344

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

Brightness Sync/AppDelegate.swift

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
8787
UserDefaults.standard.set(newValue, forKey: "BSLockBrightness")
8888
}
8989
}
90+
9091
let lockOffsetMenuItem = NSMenuItem(title: "Lock", action: #selector(toggleLockOffset), keyEquivalent: "")
9192
@objc func toggleLockOffset() {
9293
lockOffset.toggle()
@@ -270,41 +271,41 @@ class AppDelegate: NSObject, NSApplicationDelegate {
270271
let isOnConsole = (CGSessionCopyCurrentDictionary() as NSDictionary?)?[kCGSessionOnConsoleKey] as? Bool ?? false
271272

272273
if isOnConsole {
273-
let builtin = activeDisplays
274-
.filter { CGDisplayIsBuiltin($0) == 1 }
275-
.compactMap { CGDisplayCreateUUIDFromDisplayID($0)?.takeRetainedValue() }
276-
.first
277-
278-
let targets = activeDisplays
279-
.filter {
280-
if let displayInfo = CoreDisplay_DisplayCreateInfoDictionary($0)?.takeRetainedValue() as NSDictionary? {
281-
if
282-
let displayNames = displayInfo[kDisplayProductName] as? NSDictionary,
283-
let displayName = displayNames["en_US"] as? NSString
284-
{
274+
let builtin = activeDisplays
275+
.filter { CGDisplayIsBuiltin($0) == 1 }
276+
.compactMap { CGDisplayCreateUUIDFromDisplayID($0)?.takeRetainedValue() }
277+
.first
278+
279+
let targets = activeDisplays
280+
.filter {
281+
if let displayInfo = CoreDisplay_DisplayCreateInfoDictionary($0)?.takeRetainedValue() as NSDictionary? {
285282
if
286-
displayName.contains("LG UltraFine")
283+
let displayNames = displayInfo[kDisplayProductName] as? NSDictionary,
284+
let displayName = displayNames["en_US"] as? NSString
287285
{
288-
os_log("Found compatible display: %{public}@", displayName)
289-
return true
286+
if
287+
displayName.contains("LG UltraFine")
288+
{
289+
os_log("Found compatible display: %{public}@", displayName)
290+
return true
291+
}
292+
else {
293+
os_log("Found incompatible display: %{public}@", displayName)
294+
return false
295+
}
290296
}
291297
else {
292-
os_log("Found incompatible display: %{public}@", displayName)
298+
os_log("Display without en_US name found.")
293299
return false
294300
}
295-
}
296-
else {
297-
os_log("Display without en_US name found.")
301+
} else {
302+
os_log("Display without retrievable info found.")
298303
return false
299304
}
300-
} else {
301-
os_log("Display without retrievable info found.")
302-
return false
303305
}
304-
}
305-
.compactMap { CGDisplayCreateUUIDFromDisplayID($0)?.takeRetainedValue() }
306+
.compactMap { CGDisplayCreateUUIDFromDisplayID($0)?.takeRetainedValue() }
306307

307-
displaysPublisher.send((builtin, targets))
308+
displaysPublisher.send((builtin, targets))
308309
} else {
309310
displaysPublisher.send((nil, []))
310311
os_log("User not active")

0 commit comments

Comments
 (0)