Skip to content

Commit

Permalink
Skip re-apply to displays known to respond poorly to it
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Nov 15, 2023
1 parent 63a25dd commit 9410203
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,15 @@ function getKnownDisplays(useCurrentMonitors) {
}

// Look up all known displays and re-apply last brightness
function setKnownBrightness(useCurrentMonitors = false, useTransition = false, transitionSpeed = 1) {
function setKnownBrightness(useCurrentMonitors = false, useTransition = false, transitionSpeed = 1, skipBadDisplays = false) {

console.log(`\x1b[36mSetting brightness for known displays\x1b[0m`, useCurrentMonitors, useTransition, transitionSpeed)

const known = getKnownDisplays(useCurrentMonitors)
applyProfile(known, useTransition, transitionSpeed)
}

function applyProfile(profile = {}, useTransition = false, transitionSpeed = 1) {
function applyProfile(profile = {}, useTransition = false, transitionSpeed = 1, skipBadDisplays = false) {

applyOrder(profile)
applyRemaps(profile)
Expand All @@ -844,6 +844,7 @@ function applyProfile(profile = {}, useTransition = false, transitionSpeed = 1)
for (const hwid in profile) {
try {
const monitor = profile[hwid]
if(skipBadDisplays && monitorRules.skipReapply.includes(monitor.hwid[1])) continue; // Skip bad displays
transitionMonitors[monitor.id] = monitor.brightness
} catch (e) { console.log("Couldn't set brightness for known display!") }
}
Expand All @@ -856,6 +857,7 @@ function applyProfile(profile = {}, useTransition = false, transitionSpeed = 1)

// Apply brightness to valid display types
if (monitor.type == "wmi" || (monitor.type == "ddcci" && monitor.brightnessType)) {
if(skipBadDisplays && monitorRules.skipReapply.includes(monitor.hwid[1])) continue; // Skip bad displays
updateBrightness(monitor.id, monitor.brightness)
}
} catch (e) { console.log("Couldn't set brightness for known display!") }
Expand Down

0 comments on commit 9410203

Please sign in to comment.