1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 06:52:50 -05:00

osd: also have left center and right center options

This commit is contained in:
bbedward
2025-11-17 14:05:04 -05:00
parent ccb4da3cd8
commit d1472dfcba
6 changed files with 414 additions and 20 deletions

View File

@@ -78,10 +78,15 @@ Singleton {
}
}
const oldValue = deviceBrightness[device.id]
const newBrightness = Object.assign({}, deviceBrightness)
newBrightness[device.id] = displayValue
deviceBrightness = newBrightness
brightnessVersion++
if (oldValue !== undefined && oldValue !== displayValue && brightnessInitialized) {
brightnessChanged(true)
}
}
function updateFromBrightnessState(state) {
@@ -110,9 +115,12 @@ Singleton {
deviceMaxCache = newMaxCache
const newBrightness = {}
let anyDeviceBrightnessChanged = false
for (const device of state.devices) {
const isExponential = SessionData.getBrightnessExponential(device.id)
const userSetValue = deviceBrightnessUserSet[device.id]
const oldValue = deviceBrightness[device.id]
if (isExponential) {
if (userSetValue !== undefined) {
@@ -123,6 +131,11 @@ Singleton {
} else {
newBrightness[device.id] = device.currentPercent
}
const newValue = newBrightness[device.id]
if (oldValue !== undefined && oldValue !== newValue) {
anyDeviceBrightnessChanged = true
}
}
deviceBrightness = newBrightness
brightnessVersion++
@@ -142,9 +155,15 @@ Singleton {
}
}
const shouldShowOsd = brightnessInitialized && anyDeviceBrightnessChanged
if (!brightnessInitialized) {
brightnessInitialized = true
}
if (shouldShowOsd) {
brightnessChanged(true)
}
}
function setBrightness(percentage, device, suppressOsd) {