dwm-flyschemes-6.7.diff (7342B)
1 diff -upN dwm-6.7/config.def.h dwm-6.7-patched-flyschemes/config.def.h 2 --- dwm-6.7/config.def.h 2026-01-10 13:33:58.160268753 +0300 3 +++ dwm-6.7-patched-flyschemes/config.def.h 2026-01-12 16:58:40.166555474 +0300 4 @@ -7,15 +7,19 @@ static const int showbar = 1; 5 static const int topbar = 1; /* 0 means bottom bar */ 6 static const char *fonts[] = { "monospace:size=10" }; 7 static const char dmenufont[] = "monospace:size=10"; 8 -static const char col_gray1[] = "#222222"; 9 -static const char col_gray2[] = "#444444"; 10 -static const char col_gray3[] = "#bbbbbb"; 11 -static const char col_gray4[] = "#eeeeee"; 12 -static const char col_cyan[] = "#005577"; 13 -static const char *colors[][3] = { 14 - /* fg bg border */ 15 - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 16 - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 17 + 18 +#include "flyschemes.h" 19 + 20 +static const char *(*flyschemes[])[3] = { 21 + flyscheme_default, 22 + flyscheme_light, 23 + flyscheme_plan9, 24 + flyscheme_dracula, 25 + flyscheme_solarized, 26 + flyscheme_nord, 27 + flyscheme_gruvbox, 28 + flyscheme_cyberpunk, 29 + NULL /* used to count the number of flyschemes */ 30 }; 31 32 /* tagging */ 33 @@ -58,7 +62,16 @@ static const Layout layouts[] = { 34 35 /* commands */ 36 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 37 -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 38 +static const char *dmenucmd[] = { 39 + "dmenu_run", 40 + "-m", dmenumon, 41 + "-fn", dmenufont, 42 + "-nb", "#222222", /* changed as dmenucmd[6] in cycle_flyschemes */ 43 + "-nf", "#bbbbbb", /* changed as dmenucmd[8] in cycle_flyschemes */ 44 + "-sb", "#005577", /* changed as dmenucmd[10] in cycle_flyschemes */ 45 + "-sf", "#eeeeee", /* changed as dmenucmd[12] in cycle_flyschemes */ 46 + NULL 47 +}; 48 static const char *termcmd[] = { "st", NULL }; 49 50 static const Key keys[] = { 51 @@ -74,7 +87,9 @@ static const Key keys[] = { 52 { MODKEY, XK_l, setmfact, {.f = +0.05} }, 53 { MODKEY, XK_Return, zoom, {0} }, 54 { MODKEY, XK_Tab, view, {0} }, 55 - { MODKEY|ShiftMask, XK_c, killclient, {0} }, 56 + { MODKEY|ShiftMask, XK_x, killclient, {0} }, 57 + { MODKEY, XK_c, cycle_flyschemes, { .i = +1 } }, 58 + { MODKEY|ShiftMask, XK_c, cycle_flyschemes, { .i = -1 } }, 59 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 60 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 61 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 62 diff -upN dwm-6.7/dwm.1 dwm-6.7-patched-flyschemes/dwm.1 63 --- dwm-6.7/dwm.1 2026-01-10 13:33:58.160268753 +0300 64 +++ dwm-6.7-patched-flyschemes/dwm.1 2026-01-12 16:55:07.489892340 +0300 65 @@ -113,9 +113,15 @@ Decrease master area size. 66 .B Mod1\-Return 67 Zooms/cycles focused window to/from master area (tiled layouts only). 68 .TP 69 -.B Mod1\-Shift\-c 70 +.B Mod1\-Shift\-x 71 Close focused window. 72 .TP 73 +.B Mod1\-c 74 +Cycle flyscheme. 75 +.TP 76 +.B Mod1\-Shift\-c 77 +Cycle flyscheme back. 78 +.TP 79 .B Mod1\-Shift\-space 80 Toggle focused window between tiled and floating state. 81 .TP 82 diff -upN dwm-6.7/dwm.c dwm-6.7-patched-flyschemes/dwm.c 83 --- dwm-6.7/dwm.c 2026-01-10 13:33:58.160268753 +0300 84 +++ dwm-6.7-patched-flyschemes/dwm.c 2026-01-12 16:55:45.363225051 +0300 85 @@ -141,6 +141,8 @@ typedef struct { 86 } Rule; 87 88 /* function declarations */ 89 +static void cycle_flyschemes(const Arg *arg); 90 +static void update_scheme(); 91 static void applyrules(Client *c); 92 static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); 93 static void arrange(Monitor *m); 94 @@ -234,6 +236,7 @@ static int xerrorstart(Display *dpy, XEr 95 static void zoom(const Arg *arg); 96 97 /* variables */ 98 +static unsigned int iflysch = 0; 99 static const char broken[] = "broken"; 100 static char stext[256]; 101 static int screen; 102 @@ -485,7 +488,7 @@ cleanup(void) 103 cleanupmon(mons); 104 for (i = 0; i < CurLast; i++) 105 drw_cur_free(drw, cursor[i]); 106 - for (i = 0; i < LENGTH(colors); i++) 107 + for (i = 0; i < LENGTH(flyscheme_default); i++) 108 drw_scm_free(drw, scheme[i], 3); 109 free(scheme); 110 XDestroyWindow(dpy, wmcheckwin); 111 @@ -1584,9 +1587,9 @@ setup(void) 112 cursor[CurResize] = drw_cur_create(drw, XC_sizing); 113 cursor[CurMove] = drw_cur_create(drw, XC_fleur); 114 /* init appearance */ 115 - scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); 116 - for (i = 0; i < LENGTH(colors); i++) 117 - scheme[i] = drw_scm_create(drw, colors[i], 3); 118 + scheme = ecalloc(LENGTH(flyscheme_default), sizeof(Clr *)); 119 + for (i = 0; i < LENGTH(flyscheme_default); i++) 120 + scheme[i] = drw_scm_create(drw, flyscheme_default[i], 3); 121 /* init bars */ 122 updatebars(); 123 updatestatus(); 124 @@ -2140,6 +2143,36 @@ zoom(const Arg *arg) 125 pop(c); 126 } 127 128 +void 129 +update_scheme() 130 +{ 131 + scheme[SchemeNorm] = drw_scm_create(drw, flyschemes[iflysch][SchemeNorm], 3); 132 + scheme[SchemeSel] = drw_scm_create(drw, flyschemes[iflysch][SchemeSel], 3); 133 + dmenucmd[6] = flyschemes[iflysch][SchemeNorm][1]; 134 + dmenucmd[8] = flyschemes[iflysch][SchemeNorm][0]; 135 + dmenucmd[10] = flyschemes[iflysch][SchemeSel][1]; 136 + dmenucmd[12] = flyschemes[iflysch][SchemeSel][0]; 137 + Client *cl = selmon->sel; 138 + Client *c; 139 + Monitor *m; 140 + for (m = mons; m; m = m->next) 141 + for (c = m->clients; c; c = c->next) 142 + focus(c); 143 + focus(cl); 144 +} 145 + 146 +void 147 +cycle_flyschemes(const Arg *arg) 148 +{ 149 + int flyschemes_limit = 256; 150 + int i; 151 + for(i = 0; flyschemes[i] != NULL && i < flyschemes_limit; i++) 152 + ; 153 + iflysch += i + arg->i; 154 + iflysch %= i; 155 + update_scheme(); 156 +} 157 + 158 int 159 main(int argc, char *argv[]) 160 { 161 diff -upN dwm-6.7/flyschemes.h dwm-6.7-patched-flyschemes/flyschemes.h 162 --- dwm-6.7/flyschemes.h 1970-01-01 03:00:00.000000000 +0300 163 +++ dwm-6.7-patched-flyschemes/flyschemes.h 2026-01-12 16:58:30.953222295 +0300 164 @@ -0,0 +1,42 @@ 165 + 166 +/* loaded on dwm launch, has to be present */ 167 +static const char *flyscheme_default[][3] = { 168 + [SchemeNorm] = { "#bbbbbb", "#222222", "#444444" }, 169 + [SchemeSel] = { "#eeeeee", "#005577", "#005577" }, 170 +}; 171 + 172 +static const char *flyscheme_dracula[][3] = { 173 + [SchemeNorm] = { "#f8f8f2", "#282a36", "#44475a" }, 174 + [SchemeSel] = { "#282a36", "#bd93f9", "#bd93f9" }, 175 +}; 176 + 177 +static const char *flyscheme_solarized[][3] = { 178 + [SchemeNorm] = { "#839496", "#002b36", "#073642" }, 179 + [SchemeSel] = { "#002b36", "#2aa198", "#2aa198" }, 180 +}; 181 + 182 +static const char *flyscheme_nord[][3] = { 183 + [SchemeNorm] = { "#d8dee9", "#2e3440", "#4c566a" }, 184 + [SchemeSel] = { "#2e3440", "#88c0d0", "#88c0d0" }, 185 +}; 186 + 187 +static const char *flyscheme_gruvbox[][3] = { 188 + [SchemeNorm] = { "#ebdbb2", "#282828", "#3c3836" }, 189 + [SchemeSel] = { "#282828", "#fabd2f", "#fabd2f" }, 190 +}; 191 + 192 +static const char *flyscheme_light[][3] = { 193 + [SchemeNorm] = { "#222222", "#eeeeee", "#cccccc" }, 194 + [SchemeSel] = { "#ffffff", "#4a90e2", "#4a90e2" }, 195 +}; 196 + 197 +static const char *flyscheme_plan9[][3] = { 198 + [SchemeNorm] = { "#000000", "#ffffea", "#999999" }, 199 + [SchemeSel] = { "#000000", "#9ecfff", "#9ecfff" }, 200 +}; 201 + 202 +static const char *flyscheme_cyberpunk[][3] = { 203 + [SchemeNorm] = { "#00ffcc", "#0d0221", "#1d1231" }, 204 + [SchemeSel] = { "#0d0221", "#ff00aa", "#ff00aa" }, 205 +}; 206 +