Repository navigation
Conversation
Rotation is four buttons (Normal, 90°, 180°, 270°); Position is a picker of where to put a screen relative to another connected one - left, right, above or below - computed from what that screen is actually running rather than typed by hand. Neither was safe to add without a fix: monitor_in_force carried mode and scale forward on every write but not position or transform, so a display with either set by hand lost it back to auto and normal the moment any other field changed - a rule that omits a field resets it, it does not leave it alone. Both are now carried forward once one is on record. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DaqjUZXELetpEKwXMvVbLm
twiking
left a comment
There was a problem hiding this comment.
Thanks — the carry-forward fix in monitor_in_force addresses a real bug, and Rotation as four pills is right. Two correctness problems and one gap before this can go in. Verified on a laptop in clamshell mode with the internal panel disabled, reading state against a sandbox store (no live writes).
-
Align offers a disabled display as a neighbour.
alignOptions()skips displays that are not connected, but not ones Hyprland has turned off. A disabled panel still reportsx: 0, y: 0, so the picker offers "Left of " etc. computed against a screen that shows nothing and overlaps the external one. Filter onother.disabledtoo. -
Resetting Position pins the coordinates instead of returning to auto. The reset path records the pre-write value with
monitor_value_now, which for a connected display is its live coordinates, neverauto. On reset that is written back, thenmonitor_unsetfills the rule frommonitor_in_force, which now includespositionwhenever our store has one. If any other setting on that display remains, the rule keeps an explicitposition = "0x0"forever and the display stops reflowing — exactly what your comment says most displays should keep doing. Only when Position is the last setting doesmonitor_forgetdrop the rule. Same shape for a hand-writtenposition = "auto":monitor_in_forcecarries the live coordinates forward rather than the literalauto. Suggest carryingours.position // theirs.positionliterally, and only falling back to live coordinates when neither has one. -
autois unreachable from the page.monitor_stateresolves position as ours, else live, else theirs, elseauto. A connected display always has a live position, so the picker shows "0, 0" for a display nobody positioned, and theautovaluemonitor_setaccepts is never offered. A first option "Automatic" writingautowould fix this and give reset a sane target.
Everything else checks out: qmllint shows only the usual unqualified-access notes, omarchy plugin validate passes, transform 0–3 matches the labels, and the 90°/270° footprint swap is right.
| var mine = logicalFootprint(modelData) | ||
| var out = [] | ||
| for (var i = 0; i < displays.length; i++) { | ||
| var other = displays[i] |
There was a problem hiding this comment.
A display Hyprland has turned off (disabled: true, e.g. the laptop panel in clamshell) is still connected and still reports x: 0, y: 0, so it ends up offered as a neighbour with coordinates overlapping the screen that is actually on. Skip other.disabled here as well.
| theirs=$(jq -c --arg n "$name" '.[$n] // {}' <<<"$(monitor_config_settings)") | ||
| jq -c --argjson ours "$ours" --argjson theirs "$theirs" ' | ||
| { mode: .mode, scale: .scale } | ||
| + (if ($ours.position != null) or ($theirs.position != null) then { position: .position } else {} end) |
There was a problem hiding this comment.
This carries the live coordinates forward, not the recorded value. When their config says position = "auto", or when our own position is being unset via monitor_unset, the rule ends up with an explicit "0x0" and the display stops reflowing. Prefer $ours.position // $theirs.position literally, and use .position from the live display only when neither has one.
| mode: ($ours.mode // $live.mode // $theirs.mode // "preferred"), | ||
| scale: ($ours.scale // $live.scale // $theirs.scale // 1), | ||
| transform: ($ours.transform // $live.transform // $theirs.transform // 0), | ||
| position: ($ours.position // $live.position // $theirs.position // "auto"), |
There was a problem hiding this comment.
For a connected display $live.position is always set, so this never resolves to auto and the page shows coordinates for a display nobody positioned. The auto value monitor_set accepts is therefore unreachable from the picker. Consider resolving $ours.position // $theirs.position // "auto" here and offering an "Automatic" option first in the picker.
There was a problem hiding this comment.
added it. It only shows up once there's something to align against
0K5pr33
left a comment
There was a problem hiding this comment.
Disabled displays as align targets -> alignOptions() now skips other.disabled === true alongside disconnected displays, so a panel that's off (but still reporting x:0,y:0) is no longer offered as a neighbour.
Reset pinning coordinates instead of auto. Two changes were needed, not one:
monitor_in_force now carries ours.position // theirs.position literally instead of substituting live coordinates.
The actual root cause was monitor_value_now: it read a connected display's position straight off hyprctl's live output, which is never "auto" ,so the very first time Position was touched, the "value to restore on reset" got recorded as whatever coordinates the display happened to occupy. Resolve position the same way monitor_state does (ours // theirs // "auto").
auto unreachable from the page -> monitor_state no longer falls back to live coordinates before "auto", and the picker now offers an explicit "Automatic" option (writing auto) whenever there's at least one other display to align against.
Also added tests/integration_tests/clamshell_test.py .Simulates a docked laptop (internal panel disabled) by faking hyprctl on PATH, so this scenario is testable without the hardware. Verified it fails against the pre-fix code and passes against the fix.
Rotation is four buttons (Normal, 90°, 180°, 270°); Position is a picker of where to put a screen relative to another connected one - left, right, above or below - computed from what that screen is actually running rather than typed by hand.
Neither was safe to add without a fix: monitor_in_force carried mode and scale forward on every write but not position or transform, so a display with either set by hand lost it back to auto and normal the moment any other field changed - a rule that omits a field resets it, it does not leave it alone. Both are now carried forward once one is on record.