feat: Add XSECURELOCK_TOP_LEFT for top-left alignment #191
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.
This pull request introduces a new feature that allows users to align the authentication window to the top-left corner of the screen.
Description
A new environment variable,
XSECURELOCK_TOP_LEFT, has been added. When set to x:y coordinates (e.g., 10:10), it positions the authentication window at that specific top-left corner. If the variable is not set, the window remains centered, preserving the existing default behavior.This provides users with more flexibility to customize the look and feel of the lock screen, especially for tiling window manager users or those with specific multi-monitor setups.
Implementation Details
The following changes were made to
helpers/auth_x11.c:Window Positioning: The
CreateOrUpdatePerMonitorWindowfunction now checks for theXSECURELOCK_TOP_LEFTvariable. If it's set, the function uses the provided coordinates to calculate the window's position. Otherwise, it continues to center the window on the monitor.Text Alignment: In the
DisplayMessagefunction, the horizontal position of each line of text is now determined by whetherXSECURELOCK_TOP_LEFTis set. If it is, the text is aligned to the left (x-coordinate 0 within the window); otherwise, it is centered.Line Spacing: The vertical spacing between lines of text has been adjusted. When top-left alignment is active, the spacing is reduced for a more compact appearance.
Vertical Centering: The initial vertical position (y) of the text block is now calculated to start from the top of the window when
XSECURELOCK_TOP_LEFTis set, removing the previous top margin that was present for centered alignment.Documentation
The
README.mdfile has been updated to include documentation for the newXSECURELOCK_TOP_LEFTenvironment variable.This change has been tested manually to ensure that both the new top-left alignment and the default centered alignment work as expected.
./run-linter.shandtest/run-tests.shhave been run without new errors for this edit. Some error came out but not regarding this new edit.We are open to make any changes to make the pull request possible.