Rebuild Displays around the canvas, and let the transaction keep color
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -48,6 +48,15 @@ for contract in \
|
||||
'primary: monitor.name === primaryName'; do
|
||||
rg -Fq "$contract" "$service" || fail "display service contract is missing: $contract"
|
||||
done
|
||||
# The rest of the record rides the same transaction. Colour and mirroring are
|
||||
# verified by readback like geometry; the VRR override is applied and never
|
||||
# verified, because the readback field is live adaptive-sync state rather than
|
||||
# the configured policy. Either way they are part of currentLayout, which is
|
||||
# what stops one apply from clobbering another field's value.
|
||||
for contract in 'colorProfile' 'bitdepth' 'sdrBrightness' 'mirrorOf' 'vrrMode'; do
|
||||
rg -Fq "$contract" "$service" || fail "the extended display record is missing: $contract"
|
||||
done
|
||||
|
||||
rg -Fq 'enabled: Displays.canConfirm' "$page" \
|
||||
|| fail 'Keep is enabled before the display change is verified'
|
||||
rg -Fq 'options: Displays.scalesForMode(' "$page" \
|
||||
@@ -67,7 +76,8 @@ rg -Fq 'if (root.busy)' "$service" \
|
||||
|
||||
# Stored JSON is untyped at field level, so the Lua startup consumer is the
|
||||
# final validation boundary and must support every named output it accepts.
|
||||
for contract in 'valid_mode' 'valid_scale' 'valid_transform' 'valid_position' 'valid_primary' 'pairs(displays)'; do
|
||||
for contract in 'valid_mode' 'valid_scale' 'valid_transform' 'valid_position' 'valid_primary' \
|
||||
'color_profile' 'bitdepth_value' 'vrr_value' 'sdr_value' 'mirror_value' 'pairs(displays)'; do
|
||||
rg -Fq "$contract" "$monitors_lua" || fail "monitor startup validation is missing: $contract"
|
||||
done
|
||||
|
||||
@@ -93,6 +103,7 @@ package.preload["prefs"] = function()
|
||||
["HDMI-A-1"] = {
|
||||
mode = "2560x1440@60", scale = 1, transform = 1,
|
||||
x = 3000, y = 0, primary = false,
|
||||
vrrMode = -1,
|
||||
},
|
||||
["LEGACY-1"] = { mode = "1920x1080@60", scale = 1.5, transform = 0 },
|
||||
["PARTIAL-1"] = {
|
||||
@@ -107,6 +118,24 @@ package.preload["prefs"] = function()
|
||||
mode = "1920x1080@60", scale = 1, transform = 0,
|
||||
x = 4440, y = 0, primary = false,
|
||||
},
|
||||
-- The extended record, as Settings stores it.
|
||||
["DP-3"] = {
|
||||
mode = "1920x1080@60", scale = 1, transform = 0,
|
||||
x = 4440, y = 0, primary = false,
|
||||
colorProfile = "srgb", bitdepth = 10,
|
||||
sdrBrightness = 1.2, sdrSaturation = 1.0,
|
||||
vrrMode = 2, mirrorOf = "DP-2",
|
||||
},
|
||||
-- Every new field impossible at once. Geometry is fine, so the
|
||||
-- display is still configured; the bad fields drop out one by
|
||||
-- one exactly as an invalid position does.
|
||||
["DP-4"] = {
|
||||
mode = "1920x1080@60", scale = 1, transform = 0,
|
||||
x = 6360, y = 0, primary = false,
|
||||
colorProfile = "neon", bitdepth = 12,
|
||||
sdrBrightness = 9, sdrSaturation = -1,
|
||||
vrrMode = 7, mirrorOf = "BAD OUTPUT",
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -139,9 +168,38 @@ assert(by_output["PARTIAL-1"] == nil)
|
||||
assert(by_output["BAD-PRIMARY"] == nil)
|
||||
assert(by_output["BAD OUTPUT"] == nil)
|
||||
assert(by_output[""] ~= nil)
|
||||
|
||||
-- The extended record reaches the compositor under Hyprland's own key names.
|
||||
assert(by_output["DP-3"].cm == "srgb")
|
||||
assert(by_output["DP-3"].bitdepth == 10)
|
||||
assert(by_output["DP-3"].sdrbrightness == 1.2)
|
||||
assert(by_output["DP-3"].vrr == 2)
|
||||
assert(by_output["DP-3"].mirror == "DP-2")
|
||||
-- A mirrored output shows its target's picture in its target's place, so the
|
||||
-- saved position is not ours to ask for.
|
||||
assert(by_output["DP-3"].position == "auto")
|
||||
-- Neutral SDR saturation is left out rather than written: a rule that names it
|
||||
-- pins the display to it.
|
||||
assert(by_output["DP-3"].sdrsaturation == nil)
|
||||
|
||||
-- -1 means "follow the global policy", which is the absence of an override,
|
||||
-- not an override with a special value. Writing a vrr key here would silently
|
||||
-- take this display out of the gaming policy it is meant to follow.
|
||||
assert(by_output["HDMI-A-1"].vrr == nil)
|
||||
|
||||
-- Bad fields drop, the display survives. This is the same fallback invalid
|
||||
-- geometry gets, and it matters more here: refusing the whole entry over an
|
||||
-- unreadable colour profile would lose the resolution too.
|
||||
assert(by_output["DP-4"] ~= nil)
|
||||
assert(by_output["DP-4"].position == "6360x0")
|
||||
assert(by_output["DP-4"].cm == nil)
|
||||
assert(by_output["DP-4"].bitdepth == nil)
|
||||
assert(by_output["DP-4"].sdrbrightness == nil)
|
||||
assert(by_output["DP-4"].vrr == nil)
|
||||
assert(by_output["DP-4"].mirror == nil)
|
||||
LUA
|
||||
|
||||
rg -Fq 'Resolution, scale, rotation, position, and primary display' \
|
||||
rg -Fq 'Resolution, scale, rotation, position, primary display, color, VRR override, and mirroring' \
|
||||
"$repo_dir/config/dot/quickshell/config/PreferenceSchema.qml" \
|
||||
|| fail 'the display preference does not document complete layout persistence'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user