added zoom swap patch
This commit is contained in:
parent
473d03fefa
commit
9d1be1dc5c
@ -25,6 +25,7 @@ Patches
|
||||
- sticky
|
||||
- warp mouse to center of focussed window
|
||||
- scratchpads
|
||||
- zoom swap
|
||||
|
||||
|
||||
Requirements
|
||||
|
40
dwm.c
40
dwm.c
@ -169,6 +169,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);
|
||||
@ -248,6 +249,7 @@ static void centeredmaster(Monitor *m);
|
||||
static void centeredfloatingmaster(Monitor *m);
|
||||
|
||||
/* variables */
|
||||
static Client *prevzoom = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
@ -831,6 +833,16 @@ expose(XEvent *e)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -2245,14 +2257,38 @@ 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 == 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;
|
||||
pop(c);
|
||||
} 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
|
||||
|
95
patches/dwm-zoomswap-6.2.diff
Normal file
95
patches/dwm-zoomswap-6.2.diff
Normal file
@ -0,0 +1,95 @@
|
||||
From 3867ef5a68e15a4faff377ddbc8371853de4a800 Mon Sep 17 00:00:00 2001
|
||||
From: aleks <aleks.stier@icloud.com>
|
||||
Date: Sat, 19 Oct 2019 00:56:21 +0200
|
||||
Subject: [PATCH] Put master to exact position of zoomed client
|
||||
|
||||
The default behaviour when zooming a client is to put the previous
|
||||
master on top of the client-stack. This patch puts the master to the
|
||||
exact position of the zoomed client in the stack.
|
||||
---
|
||||
dwm.c | 44 ++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 40 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..1719b36 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -165,6 +165,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);
|
||||
@@ -235,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
+static Client *prevzoom = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
@@ -780,6 +782,16 @@ expose(XEvent *e)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
+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)
|
||||
{
|
||||
@@ -2114,14 +2126,38 @@ 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 (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
|
||||
--
|
||||
2.23.0
|
||||
|
Loading…
Reference in New Issue
Block a user