Watch
1
0
Fork
You've already forked souveraine
0

settings: write the dim value through, drop the invented clamp

Clamping the lock-screen grace to blank-1 turned a 30s dim on a 15s blank
into a 14s grace, dimming one second after you stop touching the phone.
This commit is contained in:
Fimeg 2026-07-26 20:00:50 -04:00
commit be72019883

View file

@ -66,9 +66,8 @@ ContentPage {
// much warning do I get before the screen goes away", once. Splitting it
// made the page describe our architecture instead of their screen.
//
// Written to both: the shell's dimBeforeLockSeconds and sessiond's
// dim_grace_secs. The lock-screen side is clamped below, because a dim
// longer than the blank budget is a dim that never shows.
// Written to both, unchanged: the shell's dimBeforeLockSeconds and
// sessiond's dim_grace_secs.
readonly property var dimPresets: [
{ displayName: Translation.tr("5s"), icon: "brightness_medium", value: 5 },
{ displayName: Translation.tr("10s"), icon: "brightness_medium", value: 10 },
@ -77,17 +76,18 @@ ContentPage {
{ displayName: Translation.tr("3 min"), icon: "brightness_medium", value: 180 }
]
// The lock screen cannot warn for longer than it waits. Clamp rather than
// refuse: the user picked a warning length, and the honest reading of
// "30s warning, 15s blank" is "warn as early as this screen allows".
// Write the chosen value through, unchanged, to both authorities.
//
// An earlier version clamped the lock-screen grace to `blank - 1` so a
// long dim would still "fit". That was invented policy nobody asked for
// and it inverted the setting: a 30 s dim against a 15 s blank became a
// 14 s grace, which starts the dim one second after you stop touching the
// phone. A setting that silently means something else is worse than one
// that does not apply.
function applyDim(v) {
Config.options.lock.idle.dimBeforeLockSeconds = v;
if (!SessiondPolicy.available)
return;
const blank = SessiondPolicy.lockBlankAfterSecs;
SessiondPolicy.apply({
dim_grace_secs: blank > 0 ? Math.max(1, Math.min(v, blank - 1)) : v
});
if (SessiondPolicy.available)
SessiondPolicy.apply({ dim_grace_secs: v });
}
// "2 min" reads better than "120 s" in a sentence about when things happen.