dwm-flycolors-6.6-alpha.diff (4973B)
1 diff -up dwm-6.6-alpha/config.def.h dwm-6.6-flycolors-alpha/config.def.h 2 --- dwm-6.6-alpha/config.def.h 2025-12-21 17:07:31.747211857 +0300 3 +++ dwm-6.6-flycolors-alpha/config.def.h 2025-12-21 17:08:31.403879729 +0300 4 @@ -13,11 +13,23 @@ static const char col_gray1[] = "# 5 static const char col_gray2[] = "#444444"; 6 static const char col_gray3[] = "#bbbbbb"; 7 static const char col_gray4[] = "#eeeeee"; 8 -static const char col_cyan[] = "#005577"; 9 -static const char *colors[][3] = { 10 +static const char default_flycolor[] = "#666666"; 11 + 12 +static const char *flycolors[] = { 13 + "#666666", // gray 14 + "#005577", // blue 15 + "#117755", // green 16 + "#aa7711", // yellow 17 + "#771111", // red 18 + "#551177", // magenta 19 + "#aa1177", // pink 20 + NULL // used to count the array size 21 +}; 22 + 23 +static const char *colors[][3] = { 24 /* fg bg border */ 25 [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 26 - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 27 + [SchemeSel] = { col_gray4, default_flycolor, default_flycolor }, /* [1] and [2] are changed in cycle_flycolors */ 28 }; 29 30 /* tagging */ 31 @@ -59,13 +71,24 @@ static const Layout layouts[] = { 32 33 /* commands */ 34 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 35 -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 36 +static const char *dmenucmd[] = { 37 + "dmenu_run", 38 + "-m", dmenumon, 39 + "-fn", dmenufont, 40 + "-nb", col_gray1, 41 + "-nf", col_gray3, 42 + "-sb", default_flycolor, /* changed as dmenucmd[10] in cycle_flycolors */ 43 + "-sf", col_gray4, 44 + NULL 45 +}; 46 static const char *termcmd[] = { "st", NULL }; 47 48 static const Key keys[] = { 49 /* modifier key function argument */ 50 { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 51 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 52 + { MODKEY, XK_c, cycle_flycolors, { .i = +1 } }, 53 + { MODKEY|ShiftMask, XK_c, cycle_flycolors, { .i = -1 } }, 54 { MODKEY, XK_b, togglebar, {0} }, 55 { MODKEY, XK_j, focusstack, {.i = +1 } }, 56 { MODKEY, XK_k, focusstack, {.i = -1 } }, 57 @@ -75,7 +98,7 @@ static const Key keys[] = { 58 { MODKEY, XK_l, setmfact, {.f = +0.05} }, 59 { MODKEY, XK_Return, zoom, {0} }, 60 { MODKEY, XK_Tab, view, {0} }, 61 - { MODKEY|ShiftMask, XK_c, killclient, {0} }, 62 + { MODKEY|ShiftMask, XK_x, killclient, {0} }, 63 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 64 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 65 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 66 diff -up dwm-6.6-alpha/dwm.1 dwm-6.6-flycolors-alpha/dwm.1 67 --- dwm-6.6-alpha/dwm.1 2025-12-18 12:11:49.852471883 +0300 68 +++ dwm-6.6-flycolors-alpha/dwm.1 2025-12-21 17:08:31.403879729 +0300 69 @@ -113,9 +113,15 @@ Decrease master area size. 70 .B Mod1\-Return 71 Zooms/cycles focused window to/from master area (tiled layouts only). 72 .TP 73 -.B Mod1\-Shift\-c 74 +.B Mod1\-Shift\-x 75 Close focused window. 76 .TP 77 +.B Mod1\-c 78 +Cycle flycolors. 79 +.TP 80 +.B Mod1\-Shift\-c 81 +Cycle flycolors back. 82 +.TP 83 .B Mod1\-Shift\-space 84 Toggle focused window between tiled and floating state. 85 .TP 86 diff -up dwm-6.6-alpha/dwm.c dwm-6.6-flycolors-alpha/dwm.c 87 --- dwm-6.6-alpha/dwm.c 2025-12-21 17:07:31.747211857 +0300 88 +++ dwm-6.6-flycolors-alpha/dwm.c 2025-12-21 17:09:37.160547712 +0300 89 @@ -143,6 +143,8 @@ typedef struct { 90 } Rule; 91 92 /* function declarations */ 93 +static void cycle_flycolors(const Arg *arg); 94 +static void update_scheme(); 95 static void applyrules(Client *c); 96 static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); 97 static void arrange(Monitor *m); 98 @@ -237,6 +239,7 @@ static void xinitvisual(void); 99 static void zoom(const Arg *arg); 100 101 /* variables */ 102 +static unsigned int iflycol = 0; 103 static const char broken[] = "broken"; 104 static char stext[256]; 105 static int screen; 106 @@ -2187,6 +2190,31 @@ zoom(const Arg *arg) 107 pop(c); 108 } 109 110 +void 111 +update_scheme() 112 +{ 113 + unsigned int alphas[] = {borderalpha, baralpha, OPAQUE}; 114 + Client *c = selmon->sel; 115 + for (int i = 0; i < LENGTH(colors); i++) 116 + scheme[i] = drw_scm_create(drw, colors[i], alphas, 3); 117 + focus(c); 118 +} 119 + 120 +void 121 +cycle_flycolors(const Arg *arg) 122 +{ 123 + int flycolors_limit = 256; 124 + int i; 125 + for(i = 0; flycolors[i] != NULL && i < flycolors_limit; i++) 126 + ; 127 + iflycol += i + arg->i; 128 + iflycol %= i; 129 + colors[SchemeSel][1] = flycolors[iflycol]; 130 + colors[SchemeSel][2] = flycolors[iflycol]; 131 + dmenucmd[10] = flycolors[iflycol]; 132 + update_scheme(); 133 +} 134 + 135 int 136 main(int argc, char *argv[]) 137 {