summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-10-06 22:48:27 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-10-06 22:48:27 +0900
commite078b1fd10e2c1e4854b4d4718e6d34310ff0314 (patch)
tree4ecb397a4b9054b00227f87cb78240bebd789633
parent408ec6458256197ecd9042b1933b1165714897ff (diff)
Init
-rw-r--r--st/x.c15
1 files changed, 15 insertions, 0 deletions
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