sites

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

commit 1f1cf598ffc8d12995b0ffc6cdda14c9501a0724
parent 70aff1d37314f23e59effbf5cc994184efb1fcdc
Author: faradayawerty <faradayawerty@gmail.com>
Date:   Sat, 20 Dec 2025 21:12:40 +0300

[dwm][patches][flycolors] improved the code, added support for alpha

Diffstat:
Adwm.suckless.org/patches/flycolors/dwm-flycolors-6.6-alphapatch.diff | 138+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff | 165++++++++++++++++++++++++++++++++++++-------------------------------------------
Mdwm.suckless.org/patches/flycolors/index.md | 5+++++
3 files changed, 218 insertions(+), 90 deletions(-)

diff --git a/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6-alphapatch.diff b/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6-alphapatch.diff @@ -0,0 +1,138 @@ +diff -up dwm-6.6-orig/config.def.h dwm-6.6-flycolors-alphapatch/config.def.h +--- dwm-6.6-orig/config.def.h 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6-flycolors-alphapatch/config.def.h 2025-12-20 20:44:19.876078740 +0300 +@@ -11,11 +11,23 @@ static const char col_gray1[] = "# + 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 const char default_flycolor[] = "#666666"; ++ ++static const char *flycolors[] = { ++ "#666666", // gray ++ "#005577", // blue ++ "#117755", // green ++ "#aa7711", // yellow ++ "#771111", // red ++ "#551177", // magenta ++ "#aa1177", // pink ++ NULL // used to count the array size ++}; ++ ++static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeSel] = { col_gray4, default_flycolor, default_flycolor }, // [1] and [2] are changed in cycle_flycolors + }; + + /* tagging */ +@@ -57,13 +69,24 @@ 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", default_flycolor, // changed as dmenucmd[10] in cycle_flycolors ++ "-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_flycolors, { .i = +1 } }, ++ { MODKEY|ShiftMask, XK_c, cycle_flycolors, { .i = -1 } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, +@@ -73,7 +96,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]} }, +diff -up dwm-6.6-orig/dwm.1 dwm-6.6-flycolors-alphapatch/dwm.1 +--- dwm-6.6-orig/dwm.1 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6-flycolors-alphapatch/dwm.1 2025-12-20 19:41:46.605075672 +0300 +@@ -113,9 +113,15 @@ Decrease master area size. + .B Mod1\-Return + Zooms/cycles focused window to/from master area (tiled layouts only). + .TP +-.B Mod1\-Shift\-c ++.B Mod1\-Shift\-x + Close focused window. + .TP ++.B Mod1\-c ++Cycle master color. ++.TP ++.B Mod1\-Shift\-c ++Cycle master color back. ++.TP + .B Mod1\-Shift\-space + Toggle focused window between tiled and floating state. + .TP +diff -up dwm-6.6-orig/dwm.c dwm-6.6-flycolors-alphapatch/dwm.c +--- dwm-6.6-orig/dwm.c 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6-flycolors-alphapatch/dwm.c 2025-12-20 21:00:21.702764717 +0300 +@@ -141,6 +141,8 @@ typedef struct { + } Rule; + + /* function declarations */ ++static void cycle_flycolors(const Arg *arg); ++static 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); +@@ -234,6 +236,7 @@ static int xerrorstart(Display *dpy, XEr + static void zoom(const Arg *arg); + + /* variables */ ++static unsigned int iflycol = 0; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -2139,6 +2142,32 @@ zoom(const Arg *arg) + pop(c); + } + ++void ++update_scheme() ++{ ++ Client *c = selmon->sel; ++ unsigned int alphas[] = {borderalpha, baralpha, OPAQUE}; ++ for (int i = 0; i < LENGTH(colors); i++) ++ scheme[i] = drw_scm_create(drw, colors[i], alphas, 3); ++ focus(c); ++ drawbars(); ++} ++ ++void ++cycle_flycolors(const Arg *arg) ++{ ++ int flycolors_limit = 256; ++ int i; ++ for(i = 0; flycolors[i] != NULL && i < flycolors_limit; i++) ++ ; ++ iflycol += i + arg->i; ++ iflycol %= i; ++ colors[SchemeSel][1] = flycolors[iflycol]; ++ colors[SchemeSel][2] = flycolors[iflycol]; ++ update_scheme(); ++ dmenucmd[10] = flycolors[iflycol]; ++} ++ + int + main(int argc, char *argv[]) + { diff --git a/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff b/dwm.suckless.org/patches/flycolors/dwm-flycolors-6.6.diff @@ -1,69 +1,60 @@ 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"; ++++ dwm-6.6/config.def.h 2025-12-20 20:44:19.876078740 +0300 +@@ -11,11 +11,23 @@ static const char col_gray1[] = "# + 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 const char default_flycolor[] = "#666666"; + -+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 const char *flycolors[] = { ++ "#666666", // gray ++ "#005577", // blue ++ "#117755", // green ++ "#aa7711", // yellow ++ "#771111", // red ++ "#551177", // magenta ++ "#aa1177", // pink ++ NULL // used to count the array size +}; + -+static int current_main_col = 0; -+ -+static char *colors[][3] = { ++static const 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 }, ++ [SchemeSel] = { col_gray4, default_flycolor, default_flycolor }, // [1] and [2] are changed in cycle_flycolors }; /* tagging */ -@@ -57,13 +79,15 @@ static const Layout layouts[] = { +@@ -57,13 +69,24 @@ 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 *dmenucmd[] = { ++ "dmenu_run", ++ "-m", dmenumon, ++ "-fn", dmenufont, ++ "-nb", col_gray1, ++ "-nf", col_gray3, ++ "-sb", default_flycolor, // changed as dmenucmd[10] in cycle_flycolors ++ "-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_c, cycle_flycolors, { .i = +1 } }, ++ { MODKEY|ShiftMask, XK_c, cycle_flycolors, { .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[] = { +@@ -73,7 +96,7 @@ static const Key keys[] = { { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, @@ -72,56 +63,50 @@ diff -up dwm-6.6-orig/config.def.h dwm-6.6/config.def.h { 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.1 dwm-6.6/dwm.1 +--- dwm-6.6-orig/dwm.1 2025-12-18 12:11:49.852471883 +0300 ++++ dwm-6.6/dwm.1 2025-12-20 19:41:46.605075672 +0300 +@@ -113,9 +113,15 @@ Decrease master area size. + .B Mod1\-Return + Zooms/cycles focused window to/from master area (tiled layouts only). + .TP +-.B Mod1\-Shift\-c ++.B Mod1\-Shift\-x + Close focused window. + .TP ++.B Mod1\-c ++Cycle master color. ++.TP ++.B Mod1\-Shift\-c ++Cycle master color back. ++.TP + .B Mod1\-Shift\-space + Toggle focused window between tiled and floating state. + .TP 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 { ++++ dwm-6.6/dwm.c 2025-12-20 20:44:23.039412131 +0300 +@@ -141,6 +141,8 @@ typedef struct { } Rule; /* function declarations */ -+int col_count(); -+void cycle_main_col(); -+void update_scheme(); ++static void cycle_flycolors(const Arg *arg); ++static 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) +@@ -234,6 +236,7 @@ static int xerrorstart(Display *dpy, XEr + static void zoom(const Arg *arg); + + /* variables */ ++static unsigned int iflycol = 0; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -2139,6 +2142,31 @@ zoom(const Arg *arg) pop(c); } -+int col_count() -+{ -+ int i; -+ for(i = 0; cols[i] != NULL; i++) -+ ; -+ return i; -+} -+ +void +update_scheme() +{ @@ -132,19 +117,19 @@ diff -up dwm-6.6-orig/dwm.c dwm-6.6/dwm.c + drawbars(); +} + -+void cycle_main_col(const Arg *arg) ++void ++cycle_flycolors(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]; ++ int flycolors_limit = 256; ++ int i; ++ for(i = 0; flycolors[i] != NULL && i < flycolors_limit; i++) ++ ; ++ iflycol += i + arg->i; ++ iflycol %= i; ++ colors[SchemeSel][1] = flycolors[iflycol]; ++ colors[SchemeSel][2] = flycolors[iflycol]; + update_scheme(); -+ dmenucmd[10] = cols[i]; ++ dmenucmd[10] = flycolors[iflycol]; +} + int diff --git a/dwm.suckless.org/patches/flycolors/index.md b/dwm.suckless.org/patches/flycolors/index.md @@ -8,6 +8,11 @@ The available colors are gray, blue, green, yellow, purple, magenta, and red. Download -------- * [dwm-flycolors-6.6.diff](dwm-flycolors-6.6.diff) + +If you'd like to combine [alpha](../alpha/) and the flycolors patch, +you can apply the following patch on top of dwm-alpha-20250918-74edc27.diff + +* [dwm-flycolors-6.6-alphapatch.diff](dwm-flycolors-6.6-alphapatch.diff) Authors -------