sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 63534db7d072719b65bbe6f7bda29beebad02083
parent ee8825185dc03e787434e7a00efd3fd6a78dad42
Author: Listeria monocytogenes <listeria@disroot.org>
Date:   Sun,  8 Nov 2026 14:41:32 -0300

[dwm][patch][colorschemes] Update patch for v6.8

Diffstat:
Adwm.suckless.org/patches/colorschemes/dwm-colorschemes-6.8.diff | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/colorschemes/index.md | 1+
2 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/colorschemes/dwm-colorschemes-6.8.diff b/dwm.suckless.org/patches/colorschemes/dwm-colorschemes-6.8.diff @@ -0,0 +1,144 @@ +From 2bb8c86f09a162de57f7aff861286d882ec737c0 Mon Sep 17 00:00:00 2001 +From: Listeria monocytogenes <listeria@disroot.org> +Date: Sun, 8 Nov 2026 13:55:26 -0300 +Subject: [PATCH] add setscheme() to cycle between colorschemes + +--- + config.def.h | 15 +++++++++++---- + dwm.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 51 insertions(+), 13 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 81c3fc0..5dff9ed 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -12,10 +12,16 @@ static const char col_gray2[] = "#444444"; + static const char col_gray3[] = "#bbbbbb"; + static const char col_gray4[] = "#eeeeee"; + static const char col_cyan[] = "#005577"; +-static const char *colors[][3] = { +- /* fg bg border */ +- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++static const char *colors[][SchemeN][3] = { ++ /* fg bg border */ ++ { /* dark */ ++ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, ++ [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ }, ++ { /* light */ ++ [SchemeNorm] = { col_gray2, col_gray4, col_gray3 }, ++ [SchemeSel] = { col_gray1, col_cyan, col_cyan }, ++ }, + }; + + /* tagging */ +@@ -86,6 +92,7 @@ static const Key keys[] = { + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, ++ { MODKEY, XK_s, setscheme, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) +diff --git a/dwm.c b/dwm.c +index 53b393e..54497b5 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -58,7 +58,7 @@ + + /* enums */ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +-enum { SchemeNorm, SchemeSel }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeN /* keeplast */ }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ +@@ -201,6 +201,7 @@ static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); ++static void setscheme(const Arg *arg); + static void setup(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); +@@ -261,7 +262,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { + static Atom wmatom[WMLast], netatom[NetLast]; + static int running = 1; + static Cur *cursor[CurLast]; +-static Clr **scheme; ++static Clr **schemes, **scheme; + static Display *dpy; + static Drw *drw; + static Monitor *mons, *selmon; +@@ -485,9 +486,9 @@ cleanup(void) + cleanupmon(mons); + for (i = 0; i < CurLast; i++) + drw_cur_free(drw, cursor[i]); +- for (i = 0; i < LENGTH(colors); i++) +- drw_scm_free(drw, scheme[i], 3); +- free(scheme); ++ for (i = 0; i < LENGTH(colors) * SchemeN; i++) ++ drw_scm_free(drw, schemes[i], 3); ++ free(schemes); + XDestroyWindow(dpy, wmcheckwin); + drw_free(drw); + XSync(dpy, False); +@@ -1536,10 +1537,37 @@ setmfact(const Arg *arg) + arrange(selmon); + } + ++void ++setscheme(const Arg *arg) ++{ ++ ptrdiff_t si; ++ Monitor *m; ++ Client *c; ++ ++ /* select default color scheme */ ++ if (!arg || arg->i == 0) ++ si = 0; ++ else ++ si = (scheme - schemes) + arg->i * SchemeN; ++ ++ /* wrap around, won't work if (abs(arg->i) > LENGTH(colors)) */ ++ if (si < 0) ++ si += LENGTH(colors) * SchemeN; ++ else if (si >= LENGTH(colors) * SchemeN) ++ si -= LENGTH(colors) * SchemeN; ++ ++ scheme = &schemes[si]; ++ ++ drawbars(); ++ for (m = mons; m; m = m->next) ++ for (c = m->clients; c; c = c->next) ++ XSetWindowBorder(dpy, c->win, scheme[c == selmon->sel ? SchemeSel : SchemeNorm][ColBorder].pixel); ++} ++ + void + setup(void) + { +- int i; ++ int i, j; + XSetWindowAttributes wa; + Atom utf8string; + struct sigaction sa; +@@ -1584,9 +1612,12 @@ setup(void) + cursor[CurResize] = drw_cur_create(drw, XC_sizing); + cursor[CurMove] = drw_cur_create(drw, XC_fleur); + /* init appearance */ +- scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); +- for (i = 0; i < LENGTH(colors); i++) +- scheme[i] = drw_scm_create(drw, colors[i], 3); ++ schemes = ecalloc(LENGTH(colors), SchemeN * sizeof(Clr *)); ++ for (j = LENGTH(colors) - 1; j >= 0; j--) { ++ scheme = &schemes[j * SchemeN]; ++ for (i = 0; i < SchemeN; i++) ++ scheme[i] = drw_scm_create(drw, colors[j][i], 3); ++ } + /* init bars */ + updatebars(); + updatestatus(); +-- +2.56.0 + diff --git a/dwm.suckless.org/patches/colorschemes/index.md b/dwm.suckless.org/patches/colorschemes/index.md @@ -13,6 +13,7 @@ Use the default keybinding `s` to cycle between color schemes. Download -------- +* [dwm-colorschemes-6.8.diff](dwm-colorschemes-6.8.diff) (2026-11-08) * [dwm-colorschemes-6.5.diff](dwm-colorschemes-6.5.diff) (2024-12-23) Authors