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