1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

brightness: dont cap to 1 minimum for non-backlight/ddc

This commit is contained in:
bbedward
2025-11-03 15:39:49 -05:00
parent 3640d8bd24
commit 3f70ca3506
4 changed files with 24 additions and 4 deletions

View File

@@ -103,7 +103,6 @@ Singleton {
}
function setBrightness(percentage, device, suppressOsd) {
const clampedValue = Math.max(1, Math.min(100, percentage))
const actualDevice = device === "" ? getDefaultDevice() : (device || currentDevice || getDefaultDevice())
if (!actualDevice) {
@@ -111,6 +110,10 @@ Singleton {
return
}
const deviceInfo = getCurrentDeviceInfoByName(actualDevice)
const minValue = (deviceInfo && (deviceInfo.class === "backlight" || deviceInfo.class === "ddc")) ? 1 : 0
const clampedValue = Math.max(minValue, Math.min(100, percentage))
if (!DMSService.isConnected) {
console.warn("DisplayService: Not connected to DMS")
return
@@ -588,13 +591,16 @@ Singleton {
return "Invalid brightness value: " + percentage
}
const clampedValue = Math.max(1, Math.min(100, value))
const targetDevice = device || ""
if (targetDevice && !root.devices.some(d => d.id === targetDevice)) {
return "Device not found: " + targetDevice
}
const deviceInfo = targetDevice ? root.getCurrentDeviceInfoByName(targetDevice) : null
const minValue = (deviceInfo && (deviceInfo.class === "backlight" || deviceInfo.class === "ddc")) ? 1 : 0
const clampedValue = Math.max(minValue, Math.min(100, value))
root.lastIpcDevice = targetDevice
if (targetDevice && targetDevice !== root.currentDevice) {
root.setCurrentDevice(targetDevice, false)