Keep display scaling options consistent

This commit is contained in:
David Heinemeier Hansson
2026-07-23 20:37:25 -07:00
parent f20da3f94a
commit 202296324a
5 changed files with 115 additions and 30 deletions
+1 -4
View File
@@ -60,10 +60,7 @@ function availableScales(scales, width, height) {
var requested = Number(scales[i])
var effective = Number(cleanScale(requested, width, height))
// Clean scales round upward. If the mode cannot reach the requested
// scale, cleanScale caps at its largest valid value and this preset is
// not actually available.
if (!isFinite(requested) || !isFinite(effective) || effective < requested) continue
if (!isFinite(requested) || !isFinite(effective)) continue
var key = normalizeScale(effective)
var existing = byEffectiveScale[key]
+10 -1
View File
@@ -263,6 +263,15 @@ Panel {
return -1
}
function effectiveScale(scale) {
for (var i = 0; i < displays.length; i++) {
var display = displays[i]
if (display && display.focused)
return Model.cleanScale(scale, display.width, display.height)
}
return normalizeScale(scale)
}
// Playful mood-name for a given brightness percent. Bands intentionally
// span ~1020 points so casual tweaks change the label, while small
// nudges within one band don't.
@@ -781,7 +790,7 @@ Panel {
required property string scaleValue
required property int scaleIndex
text: scaleValue + "x"
text: root.effectiveScale(scaleValue) + "x"
fontSize: Style.font.caption
foreground: root.bar.foreground
fontFamily: root.bar.fontFamily