diff --git a/docs/example.Xresources b/docs/example.Xresources index 7446baf..c121989 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -97,6 +97,7 @@ - speedwm.leftlayout: 1 - speedwm.fadeinactive: 1 - speedwm.defaultlayout: 1 + - speedwm.defaultmfact: 1 - speedwm.wmclass: 1 - speedwm.stairpx: 20 - speedwm.stairdirection: 1 diff --git a/keybinds.h b/keybinds.h index b5491ce..750c940 100644 --- a/keybinds.h +++ b/keybinds.h @@ -19,7 +19,7 @@ */ static const Key keys[] = { - /* modifier chain key key function argument */ + /* modifier chain key key function argument */ /* Application keybinds */ { MODIFIER1|SHIFT, -1, XK_semicolon, spawn, RCMD(RUN) }, @@ -58,9 +58,15 @@ static const Key keys[] = { /* Layout keybinds */ { MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } }, { MODIFIER1|CONTROL|SHIFT, -1, XK_d, cyclelayout, {.i = +1 } }, +#if LAYOUT_DECK { MODIFIER1|CONTROL, -1, XK_y, setlayout, {.v = &layouts[4]} }, +#endif +#if LAYOUT_GRID { MODIFIER1|CONTROL, -1, XK_e, setlayout, {.v = &layouts[3]} }, +#endif +#if LAYOUT_TILE { MODIFIER1|CONTROL, -1, XK_r, setlayout, {.v = &layouts[1]} }, +#endif { MODIFIER1|CONTROL, -1, XK_t, setlayout, {.v = &layouts[0]} }, { MODIFIER1, -1, XK_space, setlayout, {0} }, diff --git a/options.h b/options.h index 11253a9..7e783aa 100644 --- a/options.h +++ b/options.h @@ -251,6 +251,7 @@ static int stairdirection = 1; /* 0: left-aligned, 1: right- static int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ #endif static int defaultlayout = 1; /* Reset layout when there is only one client visible */ +static int defaultmfact = 1; /* Reset mfact when there is only one client visible */ #if LAYOUT_DGRID static int forcevsplit = 1; /* Force two clients to always split vertically in the dynamic grid layout */ #endif diff --git a/speedwm.c b/speedwm.c index d3278af..19d3dc7 100644 --- a/speedwm.c +++ b/speedwm.c @@ -219,6 +219,7 @@ struct Monitor { #if USETAGPREVIEWFIX int mouseactivated; #endif + int isreset; Client *clients; Client *sel; #if USEIPC @@ -1060,7 +1061,7 @@ buttonpress(XEvent *e) if (leftlayout) { x += TEXTW(m->ltsymbol); - } if (ev->x < x && leftlayout) { + } if (ev->x < x && leftlayout && !selmon->isreset) { click = ClkLtSymbol; // left layout } else { do { @@ -1078,7 +1079,7 @@ buttonpress(XEvent *e) #endif click = ClkTagBar; arg.ui = 1 << i; - } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !leftlayout) // right layout + } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !leftlayout && !selmon->isreset) // right layout click = ClkLtSymbol; // right layout else if (ev->x > selmon->ww - statusw + lrpad - 2 && !hidestatus) { x = selmon->ww - statusw + lrpad - 2; @@ -3582,11 +3583,15 @@ recttomon(int x, int y, int w, int h) void resetlayout(const Arg *arg) { - if (defaultlayout) { - Arg default_layout = {.v = &layouts[0]}; - Arg default_mfact = {.f = mfact + 1}; + Arg default_layout = {.v = &layouts[0]}; + Arg default_mfact = {.f = mfact + 1}; + if (defaultlayout) { setlayout(&default_layout); + selmon->isreset = 1; + } + + if (defaultmfact) { setmfact(&default_mfact); } } @@ -3621,8 +3626,12 @@ reorganizetags(const Arg *arg) { void resize(Client *c, int x, int y, int w, int h, int interact) { - if (applysizehints(c, &x, &y, &w, &h, interact)) + if (applysizehints(c, &x, &y, &w, &h, interact)) { resizeclient(c, x, y, w, h); + selmon->isreset = 1; + } else { + selmon->isreset = 0; + } } void diff --git a/xresources.h b/xresources.h index 2529651..73d98c2 100644 --- a/xresources.h +++ b/xresources.h @@ -166,6 +166,7 @@ ResourcePref resources[] = { { "fadeinactive", INTEGER, &fadeinactive }, #endif { "defaultlayout", INTEGER, &defaultlayout }, + { "defaultmfact", INTEGER, &defaultmfact }, { "wmclass", INTEGER, &wmclass }, { "clicktofocus", INTEGER, &clicktofocus }, { "roundedcorners", INTEGER, &roundedcorners },