mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
audio: add per-device max volume limit setting
This commit is contained in:
@@ -121,6 +121,8 @@ Singleton {
|
||||
|
||||
property string vpnLastConnected: ""
|
||||
|
||||
property var deviceMaxVolumes: ({})
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!isGreeterMode) {
|
||||
loadSettings();
|
||||
@@ -1052,6 +1054,35 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setDeviceMaxVolume(nodeName, maxPercent) {
|
||||
if (!nodeName)
|
||||
return;
|
||||
const updated = Object.assign({}, deviceMaxVolumes);
|
||||
const clamped = Math.max(100, Math.min(200, Math.round(maxPercent)));
|
||||
if (clamped === 100) {
|
||||
delete updated[nodeName];
|
||||
} else {
|
||||
updated[nodeName] = clamped;
|
||||
}
|
||||
deviceMaxVolumes = updated;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function getDeviceMaxVolume(nodeName) {
|
||||
if (!nodeName)
|
||||
return 100;
|
||||
return deviceMaxVolumes[nodeName] ?? 100;
|
||||
}
|
||||
|
||||
function removeDeviceMaxVolume(nodeName) {
|
||||
if (!nodeName)
|
||||
return;
|
||||
const updated = Object.assign({}, deviceMaxVolumes);
|
||||
delete updated[nodeName];
|
||||
deviceMaxVolumes = updated;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function syncWallpaperForCurrentMode() {
|
||||
if (!perModeWallpaper)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user