dwm-resetlayout-20200420-c82db69.diff - sites - public wiki contents of suckles… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-resetlayout-20200420-c82db69.diff (1839B) | |
--- | |
1 diff --git config.def.h config.def.h | |
2 index 1c0b587..eb823d3 100644 | |
3 --- config.def.h | |
4 +++ config.def.h | |
5 @@ -70,6 +70,7 @@ static Key keys[] = { | |
6 { MODKEY, XK_d, incnmaster, {.i … | |
7 { MODKEY, XK_h, setmfact, {.f … | |
8 { MODKEY, XK_l, setmfact, {.f … | |
9 + { MODKEY, XK_r, resetlayout, {0} … | |
10 { MODKEY, XK_Return, zoom, {0} … | |
11 { MODKEY, XK_Tab, view, {0} … | |
12 { MODKEY|ShiftMask, XK_c, killclient, {0} … | |
13 diff --git dwm.c dwm.c | |
14 index 4465af1..75fe777 100644 | |
15 --- dwm.c | |
16 +++ dwm.c | |
17 @@ -188,6 +188,7 @@ static void pop(Client *); | |
18 static void propertynotify(XEvent *e); | |
19 static void quit(const Arg *arg); | |
20 static Monitor *recttomon(int x, int y, int w, int h); | |
21 +static void resetlayout(const Arg *arg); | |
22 static void resize(Client *c, int x, int y, int w, int h, int interact); | |
23 static void resizeclient(Client *c, int x, int y, int w, int h); | |
24 static void resizemouse(const Arg *arg); | |
25 @@ -1265,6 +1266,16 @@ recttomon(int x, int y, int w, int h) | |
26 return r; | |
27 } | |
28 | |
29 +void | |
30 +resetlayout(const Arg *arg) | |
31 +{ | |
32 + Arg default_layout = {.v = &layouts[0]}; | |
33 + Arg default_mfact = {.f = mfact + 1}; | |
34 + | |
35 + setlayout(&default_layout); | |
36 + setmfact(&default_mfact); | |
37 +} | |
38 + | |
39 void | |
40 resize(Client *c, int x, int y, int w, int h, int interact) | |
41 { | |
42 @@ -1282,6 +1293,10 @@ resizeclient(Client *c, int x, int y, int w, int … | |
43 c->oldw = c->w; c->w = wc.width = w; | |
44 c->oldh = c->h; c->h = wc.height = h; | |
45 wc.border_width = c->bw; | |
46 + | |
47 + if ((nexttiled(c->mon->clients) == c) && !(nexttiled(c->next))) | |
48 + resetlayout(NULL); | |
49 + | |
50 XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorder… | |
51 configure(c); | |
52 XSync(dpy, False); |