changeset 4:f1f332156693

feat/fix: builtin root window bg/overlay bg always black
author Atarwn Gard <a@qwa.su>
date Sun, 12 Oct 2025 21:04:11 +0500
parents 3726f37deac1
children 0e6f1ea0ef26
files default.config.h gbwm.c
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/default.config.h	Sun Oct 12 20:54:34 2025 +0500
+++ b/default.config.h	Sun Oct 12 21:04:11 2025 +0500
@@ -26,6 +26,7 @@
 static const char *col_fg = "#ffffff";
 static const char *col_sel = "#4a90e2";
 static const char *overlay_font = "LiberationMono:size=48";
+static const char *root_bg = "#000000";
 
 // Commands
 static const char *termcmd[] = { "st", NULL };
--- a/gbwm.c	Sun Oct 12 20:54:34 2025 +0500
+++ b/gbwm.c	Sun Oct 12 21:04:11 2025 +0500
@@ -424,7 +424,7 @@
     if (!overlay_win) {
         XSetWindowAttributes wa = {
             .override_redirect = True,
-            .background_pixel = BlackPixel(dpy, DefaultScreen(dpy)),
+            .background_pixel = xft_col_bg.pixel,
             .event_mask = ExposureMask | KeyPressMask
         };
         overlay_win = XCreateWindow(dpy, root, 0, 0, sw, sh, 0,
@@ -707,6 +707,17 @@
     wm_take_focus = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
 }
 
+static void setrootbackground(void) {
+    Colormap cmap = DefaultColormap(dpy, DefaultScreen(dpy));
+    XColor color;
+
+    if (XParseColor(dpy, cmap, root_bg, &color) &&
+        XAllocColor(dpy, cmap, &color)) {
+        XSetWindowBackground(dpy, root, color.pixel);
+        XClearWindow(dpy, root);
+    }
+}
+
 int main(void) {
     signal(SIGCHLD, sigchld);
     if (!(dpy = XOpenDisplay(NULL))) {
@@ -722,6 +733,7 @@
     XDefineCursor(dpy, root, cursor);
 
     setup_colors();
+    setrootbackground();
     setup_icccm();
 
     XSelectInput(dpy, root,