Skip to content

Clamp the lock screen's password field to the screen width - #11244

Open
SimonSchubert wants to merge 1 commit into
omacom:quattrofrom
SimonSchubert:lock-field-max-width
Open

Clamp the lock screen's password field to the screen width#11244
SimonSchubert wants to merge 1 commit into
omacom:quattrofrom
SimonSchubert:lock-field-max-width

Conversation

@SimonSchubert

Copy link
Copy Markdown

The lock screen's password field is wider than any screen narrower than it, so its outline and rounded corners are cut off on both sides.

LockView sets fieldWidth: 381, a fixed width on a field anchored centerIn: parent. At 360 logical the field runs from x = −11 to x = 370. Its left and right borders are off-screen, so it reads as a full-width band:

Before After

The change

Clamp the field to the screen, less Style.gapsOut on each side. That's the same margin the polkit and reminder cards already leave with panel.width - Style.gapsOut * 2:

readonly property int fieldWidth: root.width > 0 ? Math.min(381, root.width - Style.gapsOut * 2) : 381

root.width is 0 until the lock surface is sized. The guard keeps the field at 381 until then, instead of a negative width.

Why it's safe

  • On a desktop Math.min returns 381 and the field is unchanged.
  • The password dots already shrink to fit passwordInput.width, which follows the field, so long passwords still stay visible in a narrower field.

Verification

Per agents/skills/visual-verification.md, reference and candidate captures of omarchy-shell lock preview:

  • 720x1440 at scale 2 (360 logical): the field clamps to 350, with 5px on each side and its outline closed on all four sides. That's the "after" image above.
  • 1920x1080 at scale 1: the field stays 381, and the capture matches the unpatched one to within 2/255 on 8 pixels, which is llvmpipe's anti-aliasing:
Desktop before Desktop after
  • Live switch between the two, in both directions: each matches a fresh start at the new size, and the journal is clean.

The VM runs a v4.0.3 shell, where LockView predates BackgroundMedia. To test this exact file rather than a backport, I added BackgroundMedia.qml and Util.isVideoPath from quattro for the test. The field code is identical in both versions.

A companion to #11034 and #11238, found the same way on a phone-shaped screen. Like those, it's a narrow-screen robustness fix rather than a mobile-specific one.

LockView sets fieldWidth to a fixed 381. The field is centred on the screen, so
on a screen narrower than that it is wider than the screen itself: at 360
logical it runs from x=-11 to x=370, and its outline and rounded corners are
cut off on both sides, leaving what reads as a full-width band.

The field is now clamped to the screen width less Style.gapsOut on each side,
the same margin the polkit and reminder cards already leave with
panel.width - Style.gapsOut * 2. root.width is 0 until the lock surface is
sized, so the clamp only applies once it has a real width.

On a desktop Math.min returns 381 and the field is unchanged.

Verified in a 720x1440 VM at scale 2 (360 logical), where the field clamps to
350 with 5px on each side, and at 1920x1080, where it stays 381 and the lock
screen matches the unpatched one to within llvmpipe's anti-aliasing.
@SimonSchubert
SimonSchubert marked this pull request as ready for review September 10, 2026 22:54
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.

1 participant