add zoomswap with config option
This commit is contained in:
parent
398263ff66
commit
0e7b16ba12
|
@ -39,6 +39,7 @@ static const Rule rules[] = {
|
|||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
||||
static const int zoomswap = 1; /* 0 means stack behaviour, 1 swap behaviour on zooming */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
|
|
51
dwm.c
51
dwm.c
|
@ -190,6 +190,7 @@ static void drawbar(Monitor *m);
|
|||
static void drawbars(void);
|
||||
static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static Client *findbefore(Client *c);
|
||||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
static void focusmon(const Arg *arg);
|
||||
|
@ -272,6 +273,7 @@ static void zoom(const Arg *arg);
|
|||
|
||||
/* variables */
|
||||
static Systray *systray = NULL;
|
||||
static Client *prevzoom = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
|
@ -889,6 +891,16 @@ expose(XEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
Client *
|
||||
findbefore(Client *c)
|
||||
{
|
||||
Client *tmp;
|
||||
if (c == selmon->clients)
|
||||
return NULL;
|
||||
for (tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
|
@ -2486,14 +2498,45 @@ void
|
|||
zoom(const Arg *arg)
|
||||
{
|
||||
Client *c = selmon->sel;
|
||||
Client *at = NULL, *cold, *cprevious = NULL;
|
||||
|
||||
if (!selmon->lt[selmon->sellt]->arrange
|
||||
|| (selmon->sel && selmon->sel->isfloating))
|
||||
return;
|
||||
if (c == nexttiled(selmon->clients))
|
||||
if (!c || !(c = nexttiled(c->next)))
|
||||
return;
|
||||
pop(c);
|
||||
if (!zoomswap) {
|
||||
if (c == nexttiled(selmon->clients))
|
||||
if (!c || !(c = nexttiled(c->next)))
|
||||
return;
|
||||
pop(c);
|
||||
} else {
|
||||
if (c == nexttiled(selmon->clients)) {
|
||||
at = findbefore(prevzoom);
|
||||
if (at)
|
||||
cprevious = nexttiled(at->next);
|
||||
if (!cprevious || cprevious != prevzoom) {
|
||||
prevzoom = NULL;
|
||||
if (!c || !(c = nexttiled(c->next)))
|
||||
return;
|
||||
} else
|
||||
c = cprevious;
|
||||
}
|
||||
cold = nexttiled(selmon->clients);
|
||||
if (c != cold && !at)
|
||||
at = findbefore(c);
|
||||
detach(c);
|
||||
attach(c);
|
||||
/* swap windows instead of pushing the previous one down */
|
||||
if (c != cold && at) {
|
||||
prevzoom = cold;
|
||||
if (cold && at != cold) {
|
||||
detach(cold);
|
||||
cold->next = at->next;
|
||||
at->next = cold;
|
||||
}
|
||||
}
|
||||
focus(c);
|
||||
arrange(c->mon);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue
Block a user