fix:(lock): add portrait layout support for vertical monitors#1567
Open
Mestane wants to merge 3 commits into
Open
fix:(lock): add portrait layout support for vertical monitors#1567Mestane wants to merge 3 commits into
Mestane wants to merge 3 commits into
Conversation
a4842d7 to
f89fd11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The lock screen layout was designed around landscape monitors and doesn't adapt to vertical/portrait displays. On a rotated monitor the surface is sized off screen.height, which is the long edge in portrait, so the content overflows and the side columns get squeezed against the center.
So I made the lock surface orientation-aware it now sizes against the monitor's short edge regardless of rotation, and stacks the modules vertically when the screen is in portrait.
Approach
The core fix is sizing against the monitor's short edge (min(width, height)) instead of screen.height that's the dimension the design actually scales against, and screen.height only happens to match it in landscape. Orientation is detected with a plain width < height check, avoiding the undocumented lastIpcObject.transform field.
For portrait, a separate vertical layout stacks the modules top-to-bottom: weather + resources, the clock/password block, fetch + notifications, then media. The landscape layout is untouched.
Notes
Landscape behavior is unchanged on a 1440p monitor the short edge resolves to 1440 and the scale to 1.0, identical to before, so this is a no-op for existing setups.
Tested on a dual-monitor setup with one landscape (DP-2) and one portrait display (DP-3, transform = 1).