@@ -87,6 +87,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
87
87
UserDefaults . standard. set ( newValue, forKey: " BSLockBrightness " )
88
88
}
89
89
}
90
+
90
91
let lockOffsetMenuItem = NSMenuItem ( title: " Lock " , action: #selector( toggleLockOffset) , keyEquivalent: " " )
91
92
@objc func toggleLockOffset( ) {
92
93
lockOffset. toggle ( )
@@ -270,41 +271,41 @@ class AppDelegate: NSObject, NSApplicationDelegate {
270
271
let isOnConsole = ( CGSessionCopyCurrentDictionary ( ) as NSDictionary ? ) ? [ kCGSessionOnConsoleKey] as? Bool ?? false
271
272
272
273
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 ? {
285
282
if
286
- displayName. contains ( " LG UltraFine " )
283
+ let displayNames = displayInfo [ kDisplayProductName] as? NSDictionary ,
284
+ let displayName = displayNames [ " en_US " ] as? NSString
287
285
{
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
+ }
290
296
}
291
297
else {
292
- os_log ( " Found incompatible display: %{public}@ " , displayName )
298
+ os_log ( " Display without en_US name found. " )
293
299
return false
294
300
}
295
- }
296
- else {
297
- os_log ( " Display without en_US name found. " )
301
+ } else {
302
+ os_log ( " Display without retrievable info found. " )
298
303
return false
299
304
}
300
- } else {
301
- os_log ( " Display without retrievable info found. " )
302
- return false
303
305
}
304
- }
305
- . compactMap { CGDisplayCreateUUIDFromDisplayID ( $0) ? . takeRetainedValue ( ) }
306
+ . compactMap { CGDisplayCreateUUIDFromDisplayID ( $0) ? . takeRetainedValue ( ) }
306
307
307
- displaysPublisher. send ( ( builtin, targets) )
308
+ displaysPublisher. send ( ( builtin, targets) )
308
309
} else {
309
310
displaysPublisher. send ( ( nil , [ ] ) )
310
311
os_log ( " User not active " )
0 commit comments