Merge pull request #2425 from spiros132/main

fix(Brightness): Fixes a bug with the bar widget, and also with the minimum enforce
This commit is contained in:
Lysec
2026-04-08 18:43:40 +02:00
committed by GitHub
2 changed files with 11 additions and 21 deletions
+9 -20
View File
@@ -176,29 +176,18 @@ Item {
return; return;
var shouldApplyToAll = root.applyToAllMonitors && root.getControllableMonitorCount() > 1; var shouldApplyToAll = root.applyToAllMonitors && root.getControllableMonitorCount() > 1;
if (shouldApplyToAll) { if (angle > 0) {
var direction = angle > 0 ? 1 : -1; if (shouldApplyToAll) {
var baseValue = !isNaN(monitor.queuedBrightness) ? monitor.queuedBrightness : monitor.brightness; BrightnessService.increaseBrightness();
var step = monitor.stepSize;
var minValue = monitor.minBrightnessValue;
if (direction > 0 && Settings.data.brightness.enforceMinimum && baseValue < minValue) {
baseValue = Math.max(step, minValue);
} else { } else {
baseValue = baseValue + direction * step; monitor.increaseBrightness();
} }
var targetValue = Math.max(minValue, Math.min(1, baseValue));
BrightnessService.monitors.forEach(function (m) {
if (m && m.brightnessControlAvailable) {
m.setBrightnessDebounced(targetValue);
}
});
} else if (angle > 0) {
monitor.increaseBrightness();
} else if (angle < 0) { } else if (angle < 0) {
monitor.decreaseBrightness(); if (shouldApplyToAll) {
BrightnessService.decreaseBrightness();
} else {
monitor.decreaseBrightness();
}
} }
} }
+2 -1
View File
@@ -478,7 +478,8 @@ Singleton {
} }
function setBrightness(value: real): void { function setBrightness(value: real): void {
value = Math.max(0, Math.min(1, value)); var min = Settings.data.brightness.enforceMinimum && isDdc ? 0.01 : 0;
value = Math.max(min, Math.min(1, value));
var rounded = Math.round(value * 100); var rounded = Math.round(value * 100);
// Always update internal value and trigger UI feedback immediately // Always update internal value and trigger UI feedback immediately