mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-30 15:07:49 -04:00
brightness: optimistically update OSDs, works better
This commit is contained in:
1 parent
1e6c80bd03
commit
ae5d6c1ba4
3 files changed
+80
-56
No files matched your search
@@ -148,16 +148,28 @@ Row {
|
||||
enabled: DisplayService.brightnessAvailable && targetDeviceName.length > 0
|
||||
minimum: {
|
||||
if (!targetDevice) return 1
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(targetDevice.id)
|
||||
if (isLogarithmic) {
|
||||
return 1
|
||||
}
|
||||
return (targetDevice.class === "backlight" || targetDevice.class === "ddc") ? 1 : 0
|
||||
}
|
||||
maximum: {
|
||||
if (!targetDevice) return 100
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(targetDevice.id)
|
||||
if (isLogarithmic) {
|
||||
return 100
|
||||
}
|
||||
return targetDevice.displayMax || 100
|
||||
}
|
||||
value: targetBrightness
|
||||
showValue: true
|
||||
unit: {
|
||||
if (!targetDevice) return "%"
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(targetDevice.id)
|
||||
if (isLogarithmic) {
|
||||
return "%"
|
||||
}
|
||||
return targetDevice.class === "ddc" ? "" : "%"
|
||||
}
|
||||
onSliderValueChanged: function (newValue) {
|
||||
|
||||
@@ -13,8 +13,10 @@ DankOSD {
|
||||
|
||||
Connections {
|
||||
target: DisplayService
|
||||
function onBrightnessChanged() {
|
||||
root.show()
|
||||
function onBrightnessChanged(showOsd) {
|
||||
if (showOsd) {
|
||||
root.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,11 +65,19 @@ DankOSD {
|
||||
minimum: {
|
||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
||||
if (!deviceInfo) return 1
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(deviceInfo.id)
|
||||
if (isLogarithmic) {
|
||||
return 1
|
||||
}
|
||||
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0
|
||||
}
|
||||
maximum: {
|
||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
||||
if (!deviceInfo) return 100
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(deviceInfo.id)
|
||||
if (isLogarithmic) {
|
||||
return 100
|
||||
}
|
||||
return deviceInfo.displayMax || 100
|
||||
}
|
||||
enabled: DisplayService.brightnessAvailable
|
||||
@@ -75,6 +85,10 @@ DankOSD {
|
||||
unit: {
|
||||
const deviceInfo = DisplayService.getCurrentDeviceInfo()
|
||||
if (!deviceInfo) return "%"
|
||||
const isLogarithmic = SessionData.getBrightnessLogarithmic(deviceInfo.id)
|
||||
if (isLogarithmic) {
|
||||
return "%"
|
||||
}
|
||||
return deviceInfo.class === "ddc" ? "" : "%"
|
||||
}
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
@@ -106,7 +120,7 @@ DankOSD {
|
||||
Connections {
|
||||
target: DisplayService
|
||||
|
||||
function onBrightnessChanged() {
|
||||
function onBrightnessChanged(showOsd) {
|
||||
if (!brightnessSlider.pressed && brightnessSlider.value !== DisplayService.brightnessLevel) {
|
||||
brightnessSlider.value = DisplayService.brightnessLevel
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user