summaryrefslogtreecommitdiffstats
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index 022b882..4474559 100644
--- a/dwl.c
+++ b/dwl.c
@@ -242,6 +242,7 @@ struct Monitor {
int nmaster;
char ltsymbol[16];
int asleep;
+ Client *prevc;
Drwl *drw;
Buffer *pool[2];
int lrpad;
@@ -1245,6 +1246,7 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
+ m->prevc = NULL;
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -3677,7 +3679,7 @@ xytonode(double x, double y, struct wlr_surface **psurface,
void
zoom(const Arg *arg)
{
- Client *c, *sel = focustop(selmon);
+ Client *c, *sel = focustop(selmon), *tmp = sel;
if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)
return;
@@ -3699,9 +3701,12 @@ zoom(const Arg *arg)
/* If we passed sel, move c to the front; otherwise, move sel to the
* front */
if (!sel)
- sel = c;
+ sel = selmon->prevc ? selmon->prevc : c, c = tmp;
+ wl_list_remove(&c->link);
+ wl_list_insert(&sel->link, &c->link);
wl_list_remove(&sel->link);
wl_list_insert(&clients, &sel->link);
+ selmon->prevc = c;
focusclient(sel, 1);
arrange(selmon);