1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

ddc use raw values not percent

This commit is contained in:
bbedward
2025-11-05 09:23:14 -05:00
parent ce6f3afb39
commit d834124a71
3 changed files with 33 additions and 6 deletions

View File

@@ -150,8 +150,16 @@ Row {
if (!targetDevice) return 1 if (!targetDevice) return 1
return (targetDevice.class === "backlight" || targetDevice.class === "ddc") ? 1 : 0 return (targetDevice.class === "backlight" || targetDevice.class === "ddc") ? 1 : 0
} }
maximum: 100 maximum: {
if (!targetDevice) return 100
return targetDevice.displayMax || 100
}
value: targetBrightness value: targetBrightness
showValue: true
unit: {
if (!targetDevice) return "%"
return targetDevice.class === "ddc" ? "" : "%"
}
onSliderValueChanged: function (newValue) { onSliderValueChanged: function (newValue) {
if (DisplayService.brightnessAvailable && targetDeviceName) { if (DisplayService.brightnessAvailable && targetDeviceName) {
DisplayService.setBrightness(newValue, targetDeviceName, true) DisplayService.setBrightness(newValue, targetDeviceName, true)

View File

@@ -65,10 +65,18 @@ DankOSD {
if (!deviceInfo) return 1 if (!deviceInfo) return 1
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0 return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0
} }
maximum: 100 maximum: {
const deviceInfo = DisplayService.getCurrentDeviceInfo()
if (!deviceInfo) return 100
return deviceInfo.displayMax || 100
}
enabled: DisplayService.brightnessAvailable enabled: DisplayService.brightnessAvailable
showValue: true showValue: true
unit: "%" unit: {
const deviceInfo = DisplayService.getCurrentDeviceInfo()
if (!deviceInfo) return "%"
return deviceInfo.class === "ddc" ? "" : "%"
}
thumbOutlineColor: Theme.surfaceContainer thumbOutlineColor: Theme.surfaceContainer
alwaysShowValue: SettingsData.osdAlwaysShowValue alwaysShowValue: SettingsData.osdAlwaysShowValue

View File

@@ -50,7 +50,8 @@ Singleton {
"current": device.current, "current": device.current,
"percentage": device.currentPercent, "percentage": device.currentPercent,
"max": device.max, "max": device.max,
"backend": device.backend "backend": device.backend,
"displayMax": device.class === "ddc" ? device.max : 100
} }
devices = newDevices devices = newDevices
} }
@@ -95,7 +96,8 @@ Singleton {
"current": d.current, "current": d.current,
"percentage": d.currentPercent, "percentage": d.currentPercent,
"max": d.max, "max": d.max,
"backend": d.backend "backend": d.backend,
"displayMax": d.class === "ddc" ? d.max : 100
})) }))
const newBrightness = {} const newBrightness = {}
@@ -146,7 +148,8 @@ Singleton {
const deviceInfo = getCurrentDeviceInfoByName(actualDevice) const deviceInfo = getCurrentDeviceInfoByName(actualDevice)
const minValue = (deviceInfo && (deviceInfo.class === "backlight" || deviceInfo.class === "ddc")) ? 1 : 0 const minValue = (deviceInfo && (deviceInfo.class === "backlight" || deviceInfo.class === "ddc")) ? 1 : 0
const clampedValue = Math.max(minValue, Math.min(100, percentage)) const maxValue = deviceInfo?.displayMax || 100
const clampedValue = Math.max(minValue, Math.min(maxValue, percentage))
if (!DMSService.isConnected) { if (!DMSService.isConnected) {
console.warn("DisplayService: Not connected to DMS") console.warn("DisplayService: Not connected to DMS")
@@ -256,6 +259,14 @@ Singleton {
return null return null
} }
function getDeviceMax(deviceName) {
const deviceInfo = getCurrentDeviceInfoByName(deviceName)
if (!deviceInfo) {
return 100
}
return deviceInfo.displayMax || 100
}
// Night Mode Functions - Simplified // Night Mode Functions - Simplified
function enableNightMode() { function enableNightMode() {
if (!gammaControlAvailable) { if (!gammaControlAvailable) {