sites

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

commit 4a76edac7e75afcfe29fe4f71df0570cd3740f45
parent 8350820566a1bd3129e1fdb8fc115a3a2d2e6161
Author: faradayawerty <faradayawerty@gmail.com>
Date:   Thu, 18 Dec 2025 13:03:44 +0300

add the flycolors patch for changing colors on the fly

Diffstat:
Adwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff | 152+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/flycolors/index.md | 15+++++++++++++++
2 files changed, 167 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff b/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff @@ -0,0 +1,152 @@ +diff -up dwm-6.6-orig/config.def.h dwm-6.6/config.def.h +--- dwm-6.6-orig/config.def.h 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6/config.def.h 2025-12-18 12:31:53.032438383 +0300 +@@ -7,15 +7,37 @@ static const int showbar = 1; + static const int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; +-static const char col_gray1[] = "#222222"; +-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] = { ++ ++static char col_gray1[] = "#222222"; ++static char col_gray2[] = "#444444"; ++static char col_gray3[] = "#bbbbbb"; ++static char col_gray4[] = "#eeeeee"; ++ ++#define COLOR_RED "#771111" ++#define COLOR_GREEN "#117755" ++#define COLOR_YELLOW "#aa7711" ++#define COLOR_MAGENTA "#551177" ++#define COLOR_BLUE "#005577" ++#define COLOR_GRAY "#666666" ++#define COLOR_PINK "#aa1177" ++ ++static char *cols[] = { ++ COLOR_GRAY, ++ COLOR_BLUE, ++ COLOR_GREEN, ++ COLOR_YELLOW, ++ COLOR_PINK, ++ COLOR_MAGENTA, ++ COLOR_RED, ++ NULL // used to count the number of colors ++}; ++ ++static int current_main_col = 0; ++ ++static char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeSel] = { col_gray4, COLOR_GRAY, COLOR_GRAY }, + }; + + /* tagging */ +@@ -57,13 +79,15 @@ static const Layout layouts[] = { + + /* commands */ + static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; ++static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", COLOR_GRAY, "-sf", col_gray4, NULL }; + static const char *termcmd[] = { "st", NULL }; + + static const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, ++ { MODKEY, XK_c, cycle_main_col, { .i = +1 } }, ++ { MODKEY|ShiftMask, XK_c, cycle_main_col, { .i = -1 } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, +@@ -73,7 +97,7 @@ static const Key keys[] = { + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, +- { MODKEY|ShiftMask, XK_c, killclient, {0} }, ++ { MODKEY|ShiftMask, XK_x, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, +Only in dwm-6.6: config.h +diff -up dwm-6.6-orig/drw.c dwm-6.6/drw.c +--- dwm-6.6-orig/drw.c 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6/drw.c 2025-12-18 12:22:22.002454267 +0300 +@@ -181,7 +181,7 @@ drw_clr_create(Drw *drw, Clr *dest, cons + /* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ + Clr * +-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) ++drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) + { + size_t i; + Clr *ret; +diff -up dwm-6.6-orig/drw.h dwm-6.6/drw.h +--- dwm-6.6-orig/drw.h 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6/drw.h 2025-12-18 12:22:46.195786922 +0300 +@@ -40,7 +40,7 @@ void drw_font_getexts(Fnt *font, const c + + /* Colorscheme abstraction */ + void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); ++Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); + + /* Cursor abstraction */ + Cur *drw_cur_create(Drw *drw, int shape); +diff -up dwm-6.6-orig/dwm.c dwm-6.6/dwm.c +--- dwm-6.6-orig/dwm.c 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6/dwm.c 2025-12-18 12:30:47.889106861 +0300 +@@ -141,6 +141,9 @@ typedef struct { + } Rule; + + /* function declarations */ ++int col_count(); ++void cycle_main_col(); ++void update_scheme(); + static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); + static void arrange(Monitor *m); +@@ -2139,6 +2142,39 @@ zoom(const Arg *arg) + pop(c); + } + ++int col_count() ++{ ++ int i; ++ for(i = 0; cols[i] != NULL; i++) ++ ; ++ return i; ++} ++ ++void ++update_scheme() ++{ ++ Client *c = selmon->sel; ++ for (int i = 0; i < LENGTH(colors); i++) ++ scheme[i] = drw_scm_create(drw, colors[i], 3); ++ focus(c); ++ drawbars(); ++} ++ ++void cycle_main_col(const Arg *arg) ++{ ++ current_main_col += arg->i; ++ int cols_count = col_count(); ++ if(current_main_col < 0) ++ current_main_col += cols_count; ++ if(current_main_col > cols_count) ++ current_main_col += cols_count; ++ int i = current_main_col % cols_count; ++ colors[SchemeSel][1] = cols[i]; ++ colors[SchemeSel][2] = cols[i]; ++ update_scheme(); ++ dmenucmd[10] = cols[i]; ++} ++ + int + main(int argc, char *argv[]) + { diff --git a/dwm.suckless.org/patches/flycolors/index.md b/dwm.suckless.org/patches/flycolors/index.md @@ -0,0 +1,15 @@ +flycolors +====== +The patch allows its user to change dwm panel and dmenu colors on the fly. +Seven colors are available by default, but you can add more. +The colors are gray, blue, green, yellow, purple, magenta, red. + +Download +-------- +* [dwm-flycolors-6.6.diff](dwm-flycolors-6.6.diff) + + +Authors +------- +* [faradayawerty](https://faradayawerty.neocities.org) - [faradayawerty@gmail.com](mailto:faradayawerty@gmail.com) +