From e078b1fd10e2c1e4854b4d4718e6d34310ff0314 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:48:27 +0900 Subject: Init --- st/x.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'st/x.c') diff --git a/st/x.c b/st/x.c index 66b9a35..15647c1 100644 --- a/st/x.c +++ b/st/x.c @@ -1045,6 +1045,21 @@ xloadfonts(const char *fontstr, double fontsize) FcPattern *pattern; double fontval; + // Get screen resolution + Display *dpy = XOpenDisplay(NULL); + if (!dpy) { + die("can't open display\n"); + } + int screen = DefaultScreen(dpy); + int width = XDisplayWidth(dpy, screen); + int height = XDisplayHeight(dpy, screen); + XCloseDisplay(dpy); // Close the display after getting resolution + // + // If the resolution is under 1024x768, set the fontsize to 12 + if (width < 1024 && height < 768) { + fontsize = 12; + } + if (fontstr[0] == '-') pattern = XftXlfdParse(fontstr, False, False); else -- cgit v1.2.3