summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-30 20:50:04 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-30 20:50:04 +0900
commit6669325faed2f71dd61844f177e22b40dc27ea69 (patch)
tree31bc5b286b0988e0f040499fff39d2513d228228
parentf9fc54ec83e0cd2cfc85e0991f0920df0a284b6d (diff)
modified slock/slock.c
-rw-r--r--slock/slock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/slock/slock.c b/slock/slock.c
index 86be711..f7af3c8 100644
--- a/slock/slock.c
+++ b/slock/slock.c
@@ -349,8 +349,9 @@ refresh(Display *dpy, Window win , int screen, struct tm time, cairo_t* cr, cair
text_width = extents.width;
text_height = extents.height;
- xpos = DisplayWidth(dpy, screen) / 4 - text_width / 2;
- ypos = (DisplayHeight(dpy, screen) + 12 * text_height) / 2;
+ /* Center text horizontally and vertically based on text center point */
+ xpos = (DisplayWidth(dpy, screen) / 2) - (text_width / 2) - extents.x_bearing;
+ ypos = (DisplayHeight(dpy, screen) / 2) - (text_height / 2) - extents.y_bearing;
cairo_move_to(cr, xpos, ypos);
cairo_show_text(cr, tm);
cairo_surface_flush(sfc);