diff -ruN old/config.h new/config.h --- old/config.h 2026-10-15 02:27:36.895141358 +0300 +++ new/config.h 2026-10-15 02:22:29.877680526 +0300 @@ -28,3 +28,5 @@ .font = "DejaVu Sans Mono:size=13:antialias=true", .text_height = 10, }; + +const char *xresources = "/home/michael/.cache/wal/colors.Xresources"; /* wal */ diff -ruN old/sxalert.c new/sxalert.c --- old/sxalert.c 2026-10-15 02:27:29.337141729 +0300 +++ new/sxalert.c 2026-10-15 02:24:51.835149470 +0300 @@ -66,6 +66,40 @@ return max; } +static void +get_xresources_colors(struct alert *a) +{ + FILE *f = fopen(xresources, "r"); + if (!f) { + fprintf(stderr, "Could not open file: %s\n", xresources); + exit(EXIT_FAILURE); + } + + char buffer[XR_BUFFER]; + + char colors[2][8]; + int clr_i=0; + + char *arr[2]; + + for (int i=0; i<4; i++) { + fgets(buffer, sizeof(buffer), f); + + if (i <= 1) continue; + + arr[0] = strtok(buffer, "#"); + arr[1] = strtok(NULL, "#\n"); + + strncpy(colors[clr_i++], arr[1], 7); + } + + strcpy(a->text_color, colors[0]); + strcpy(a->border_color, colors[0]); + strcpy(a->bg_color, colors[1]); + + fclose(f); +} + static int get_width(Display *dpy, XftFont *font, struct alert *a) { @@ -301,6 +335,8 @@ if (flock(fd, LOCK_EX) == -1) return 1; + get_xresources_colors(&a); + int cmd_lines_len = argc - optind; char **lines = argv + optind; diff -ruN old/sxalert.h new/sxalert.h --- old/sxalert.h 2026-10-15 02:27:32.357141581 +0300 +++ new/sxalert.h 2026-10-15 02:22:29.877893651 +0300 @@ -7,6 +7,8 @@ #ifndef SXALERT_H #define SXALERT_H +#define XR_BUFFER 128 + struct alert { int duration; char text_color[7];