Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat(displays): rotate and align against another display - #5

Open
0K5pr33 wants to merge 3 commits into
twiking:mainfrom
0K5pr33:feature/display-rotate-and-layout
Open

0K5pr33 wants to merge 3 commits into
twiking:mainfrom
0K5pr33:feature/display-rotate-and-layout

Conversation

@0K5pr33

@0K5pr33 0K5pr33 commented Sep 5, 2026

Copy link
Copy Markdown

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.

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 twiking closed this Sep 6, 2026
@twiking twiking reopened this Sep 6, 2026

@twiking twiking left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

  1. 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 reports x: 0, y: 0, so the picker offers "Left of " etc. computed against a screen that shows nothing and overlaps the external one. Filter on other.disabled too.

  2. 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, never auto. On reset that is written back, then monitor_unset fills the rule from monitor_in_force, which now includes position whenever our store has one. If any other setting on that display remains, the rule keeps an explicit position = "0x0" forever and the display stops reflowing — exactly what your comment says most displays should keep doing. Only when Position is the last setting does monitor_forget drop the rule. Same shape for a hand-written position = "auto": monitor_in_force carries the live coordinates forward rather than the literal auto. Suggest carrying ours.position // theirs.position literally, and only falling back to live coordinates when neither has one.

  3. auto is unreachable from the page. monitor_state resolves position as ours, else live, else theirs, else auto. A connected display always has a live position, so the picker shows "0, 0" for a display nobody positioned, and the auto value monitor_set accepts is never offered. A first option "Automatic" writing auto would 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]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread lib/monitors.sh Outdated
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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the behavior

Comment thread lib/monitors.sh Outdated
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"),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added it. It only shows up once there's something to align against

@0K5pr33 0K5pr33 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants