Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Commit 6200d92

Browse files
author
Radosław Stachowiak
committed
Add XSECURELOCK_AUTH_Y_POSITION env var for vertical dialog placement
Allow configuring the vertical position of the auth dialog as a percentage (0=top, 50=center, 100=bottom), defaulting to 50 (centered) to preserve existing behavior.
1 parent 779903c commit 6200d92

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ Options to XSecureLock can be passed by environment variables:
253253
the screen saver.
254254
* `XSECURELOCK_AUTH_WARNING_COLOR`: specifies the X11 color (see manpage of
255255
XParseColor) for the warning text of the auth dialog.
256+
* `XSECURELOCK_AUTH_Y_POSITION`: vertical position of the auth dialog as a
257+
percentage of screen height, from 0 (top) to 100 (bottom). Defaults to 50
258+
(vertically centered). For example, set to 80 to position the dialog near
259+
the bottom of the screen.
256260
* `XSECURELOCK_BACKGROUND_COLOR`: specifies the X11 color (see manpage
257261
of XParseColor) for the background of the main and saver windows.
258262
* `XSECURELOCK_BLANK_TIMEOUT`: specifies the time (in seconds) before telling

helpers/auth_x11.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ static int auth_sounds = 0;
245245
//! Whether to blink the cursor in the auth dialog.
246246
static int auth_cursor_blink = 1;
247247

248+
//! Vertical position of the auth dialog as a percentage (0=top, 50=center,
249+
//! 100=bottom).
250+
static int auth_y_position = 50;
251+
248252
//! Whether we only want a single auth window.
249253
static int single_auth_window = 0;
250254

@@ -570,7 +574,7 @@ void CreateOrUpdatePerMonitorWindow(size_t i, const Monitor *monitor,
570574
int w = region_w;
571575
int h = region_h;
572576
int x = monitor->x + (monitor->width - w) / 2 + x_offset;
573-
int y = monitor->y + (monitor->height - h) / 2 + y_offset;
577+
int y = monitor->y + (monitor->height - h) * auth_y_position / 100 + y_offset;
574578
// Clip to monitor.
575579
if (x < 0) {
576580
w += x;
@@ -1620,6 +1624,9 @@ int main(int argc_local, char **argv_local) {
16201624
auth_sounds = GetIntSetting("XSECURELOCK_AUTH_SOUNDS", 0);
16211625
single_auth_window = GetIntSetting("XSECURELOCK_SINGLE_AUTH_WINDOW", 0);
16221626
auth_cursor_blink = GetIntSetting("XSECURELOCK_AUTH_CURSOR_BLINK", 1);
1627+
auth_y_position = GetIntSetting("XSECURELOCK_AUTH_Y_POSITION", 50);
1628+
if (auth_y_position < 0) auth_y_position = 0;
1629+
if (auth_y_position > 100) auth_y_position = 100;
16231630
#ifdef HAVE_XKB_EXT
16241631
show_keyboard_layout =
16251632
GetIntSetting("XSECURELOCK_SHOW_KEYBOARD_LAYOUT", 1);

0 commit comments

Comments
 (0)