Patch update: Don't allow ClkLtButton if defaultmfact/defaultlayout are
enabled and there are no clients. Also add defaultmfact option, which is now separate from defaultlayout.
This commit is contained in:
parent
373f549efd
commit
1080e0025f
|
@ -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
|
||||
|
|
|
@ -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} },
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
21
speedwm.c
21
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
|
||||
|
|
|
@ -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 },
|
||||
|
|
Loading…
Reference in a new issue