1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 22:42:50 -05:00

power: add fade to monitor off option

fixes #558
This commit is contained in:
bbedward
2026-01-03 15:00:12 -05:00
parent f3f720bb37
commit 6d76f0b476
7 changed files with 219 additions and 15 deletions

View File

@@ -72,6 +72,15 @@ Item {
onToggled: checked => SettingsData.set("fadeToLockEnabled", checked)
}
SettingsToggleRow {
settingKey: "fadeToDpmsEnabled"
tags: ["fade", "dpms", "monitor", "screen", "idle", "grace period"]
text: I18n.tr("Fade to monitor off")
description: I18n.tr("Gradually fade the screen before turning off monitors with a configurable grace period")
checked: SettingsData.fadeToDpmsEnabled
onToggled: checked => SettingsData.set("fadeToDpmsEnabled", checked)
}
SettingsToggleRow {
settingKey: "lockBeforeSuspend"
tags: ["lock", "suspend", "sleep", "security"]
@@ -89,7 +98,7 @@ Item {
property var periodOptions: ["1 second", "2 seconds", "3 seconds", "4 seconds", "5 seconds", "10 seconds", "15 seconds", "20 seconds", "30 seconds"]
property var periodValues: [1, 2, 3, 4, 5, 10, 15, 20, 30]
text: I18n.tr("Fade grace period")
text: I18n.tr("Lock fade grace period")
options: periodOptions
visible: SettingsData.fadeToLockEnabled
enabled: SettingsData.fadeToLockEnabled
@@ -107,6 +116,32 @@ Item {
SettingsData.set("fadeToLockGracePeriod", periodValues[index]);
}
}
SettingsDropdownRow {
id: fadeDpmsGracePeriodDropdown
settingKey: "fadeToDpmsGracePeriod"
tags: ["fade", "grace", "period", "timeout", "dpms", "monitor"]
property var periodOptions: ["1 second", "2 seconds", "3 seconds", "4 seconds", "5 seconds", "10 seconds", "15 seconds", "20 seconds", "30 seconds"]
property var periodValues: [1, 2, 3, 4, 5, 10, 15, 20, 30]
text: I18n.tr("Monitor fade grace period")
options: periodOptions
visible: SettingsData.fadeToDpmsEnabled
enabled: SettingsData.fadeToDpmsEnabled
Component.onCompleted: {
const currentPeriod = SettingsData.fadeToDpmsGracePeriod;
const index = periodValues.indexOf(currentPeriod);
currentValue = index >= 0 ? periodOptions[index] : "5 seconds";
}
onValueChanged: value => {
const index = periodOptions.indexOf(value);
if (index < 0)
return;
SettingsData.set("fadeToDpmsGracePeriod", periodValues[index]);
}
}
SettingsDropdownRow {
id: powerProfileDropdown
settingKey: "powerProfile"