Skip to content

Commit

Permalink
fix screen setup change recognition (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasr22 authored Aug 23, 2024
1 parent f83ba5a commit 048765f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions BrightIntosh/BrightnessManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BrightnessManager {

var brightnessTechnique: BrightnessTechnique?
var screens: [NSScreen] = []
var xdrScreens: [NSScreen] = []

init() {
setBrightnessTechnique()
Expand Down Expand Up @@ -83,8 +84,7 @@ class BrightnessManager {
}

func handlePotentialScreenUpdate() {
let newScreens = getXDRDisplays()

let newScreens = NSScreen.screens
var changedScreens = newScreens.count != screens.count
if !changedScreens {
for screen in screens {
Expand All @@ -99,6 +99,7 @@ class BrightnessManager {
if changedScreens {
print("Screen setup changed")
screens = newScreens
xdrScreens = getXDRDisplays()
}

if !newScreens.isEmpty {
Expand All @@ -107,7 +108,7 @@ class BrightnessManager {
print("Enable extra brightness after screen setup change")
self.enableExtraBrightness()
} else if changedScreens {
brightnessTechnique.screenUpdate(screens: screens)
brightnessTechnique.screenUpdate(screens: xdrScreens)
} else {
brightnessTechnique.adjustBrightness()
}
Expand Down

0 comments on commit 048765f

Please sign in to comment.