diff --git a/config.def.h b/config.def.h index 95c2afa..73422ee 100644 --- a/config.def.h +++ b/config.def.h @@ -4,9 +4,12 @@ ((hex >> 8) & 0xFF) / 255.0f, \ (hex & 0xFF) / 255.0f } /* appearance */ + static const int sloppyfocus = 1; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ +// Replace colors_dir with your own path, e.g /home/yourname/.cache/dwl-colors +static const char *colors_dir = "/home/pixel/.cache/wal/dwl-colors"; static const float rootcolor[] = COLOR(0x222222ff); static const float bordercolor[] = COLOR(0x444444ff); static const float focuscolor[] = COLOR(0x005577ff); @@ -128,6 +131,7 @@ static const Key keys[] = { { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, + { MODKEY, XKB_KEY_n, reload_colors, {0} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, diff --git a/dwl.c b/dwl.c index 12f441e..0801673 100644 --- a/dwl.c +++ b/dwl.c @@ -313,6 +313,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface, static void printstatus(void); static void powermgrsetmode(struct wl_listener *listener, void *data); static void quit(const Arg *arg); +static void reload_colors(const Arg *arg); static void rendermon(struct wl_listener *listener, void *data); static void requestdecorationmode(struct wl_listener *listener, void *data); static void requeststartdrag(struct wl_listener *listener, void *data); @@ -2146,6 +2147,28 @@ quit(const Arg *arg) wl_display_terminate(dpy); } +void +reload_colors(const Arg *arg) +{ + FILE *f = fopen(colors_dir, "r"); + if (!f) { + return; + } + + for (int i = 0; i < (int)LENGTH(colors); i++) { + unsigned int fg, bg, border; + if (fscanf(f, "%x %x %x", &fg, &bg, &border) != 3) { + break; + } + colors[i][ColFg] = fg; + colors[i][ColBg] = bg; + colors[i][ColBorder] = border; + } + + fclose(f); + drawbars(); +} + void rendermon(struct wl_listener *listener, void *data) {