mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
brightness: dont cap to 1 minimum for non-backlight/ddc
This commit is contained in:
@@ -310,6 +310,13 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (screenName && screenName.length > 0 && modelData.name !== currentDeviceName) {
|
||||||
|
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}))
|
||||||
|
if (pins[screenName]) {
|
||||||
|
delete pins[screenName]
|
||||||
|
SettingsData.setBrightnessDevicePins(pins)
|
||||||
|
}
|
||||||
|
}
|
||||||
currentDeviceName = modelData.name
|
currentDeviceName = modelData.name
|
||||||
deviceNameChanged(modelData.name)
|
deviceNameChanged(modelData.name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,10 @@ Row {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: parent.width - (Theme.iconSize + Theme.spacingS * 2)
|
width: parent.width - (Theme.iconSize + Theme.spacingS * 2)
|
||||||
enabled: DisplayService.brightnessAvailable && targetDeviceName.length > 0
|
enabled: DisplayService.brightnessAvailable && targetDeviceName.length > 0
|
||||||
minimum: 1
|
minimum: {
|
||||||
|
if (!targetDevice) return 1
|
||||||
|
return (targetDevice.class === "backlight" || targetDevice.class === "ddc") ? 1 : 0
|
||||||
|
}
|
||||||
maximum: 100
|
maximum: 100
|
||||||
value: targetBrightness
|
value: targetBrightness
|
||||||
onSliderValueChanged: function (newValue) {
|
onSliderValueChanged: function (newValue) {
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ DankOSD {
|
|||||||
height: 40
|
height: 40
|
||||||
x: parent.gap * 2 + Theme.iconSize
|
x: parent.gap * 2 + Theme.iconSize
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
minimum: 1
|
minimum: {
|
||||||
|
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
||||||
|
if (!deviceInfo) return 1
|
||||||
|
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0
|
||||||
|
}
|
||||||
maximum: 100
|
maximum: 100
|
||||||
enabled: DisplayService.brightnessAvailable
|
enabled: DisplayService.brightnessAvailable
|
||||||
showValue: true
|
showValue: true
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setBrightness(percentage, device, suppressOsd) {
|
function setBrightness(percentage, device, suppressOsd) {
|
||||||
const clampedValue = Math.max(1, Math.min(100, percentage))
|
|
||||||
const actualDevice = device === "" ? getDefaultDevice() : (device || currentDevice || getDefaultDevice())
|
const actualDevice = device === "" ? getDefaultDevice() : (device || currentDevice || getDefaultDevice())
|
||||||
|
|
||||||
if (!actualDevice) {
|
if (!actualDevice) {
|
||||||
@@ -111,6 +110,10 @@ Singleton {
|
|||||||
return
|
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) {
|
if (!DMSService.isConnected) {
|
||||||
console.warn("DisplayService: Not connected to DMS")
|
console.warn("DisplayService: Not connected to DMS")
|
||||||
return
|
return
|
||||||
@@ -588,13 +591,16 @@ Singleton {
|
|||||||
return "Invalid brightness value: " + percentage
|
return "Invalid brightness value: " + percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
const clampedValue = Math.max(1, Math.min(100, value))
|
|
||||||
const targetDevice = device || ""
|
const targetDevice = device || ""
|
||||||
|
|
||||||
if (targetDevice && !root.devices.some(d => d.id === targetDevice)) {
|
if (targetDevice && !root.devices.some(d => d.id === targetDevice)) {
|
||||||
return "Device not found: " + 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
|
root.lastIpcDevice = targetDevice
|
||||||
if (targetDevice && targetDevice !== root.currentDevice) {
|
if (targetDevice && targetDevice !== root.currentDevice) {
|
||||||
root.setCurrentDevice(targetDevice, false)
|
root.setCurrentDevice(targetDevice, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user