mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding zoomswap patch (pertag compatible)
This commit is contained in:
parent
591caea975
commit
e681ab5dd9
@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
2019-09-05 - Alpha, systray and pertag patches added
|
2019-09-05 - Alpha, systray, pertag and zoomswap patches added
|
||||||
|
|
||||||
### Patches included:
|
### Patches included:
|
||||||
|
|
||||||
@ -23,3 +23,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
- [systray](https://dwm.suckless.org/patches/systray/)
|
- [systray](https://dwm.suckless.org/patches/systray/)
|
||||||
- adds system tray in the status bar
|
- adds system tray in the status bar
|
||||||
|
|
||||||
|
- [zoomswap](https://dwm.suckless.org/patches/zoomswap/)
|
||||||
|
- allows a master and a stack window to swap places rather than every window on the screen changing position
|
||||||
|
|
||||||
|
58
dwm.c
58
dwm.c
@ -197,7 +197,9 @@ static void monocle(Monitor *m);
|
|||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
|
#if !ZOOMSWAP_PATCH
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
|
#endif // !ZOOMSWAP_PATCH
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
@ -1391,6 +1393,7 @@ nexttiled(Client *c)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !ZOOMSWAP_PATCH
|
||||||
void
|
void
|
||||||
pop(Client *c)
|
pop(Client *c)
|
||||||
{
|
{
|
||||||
@ -1399,6 +1402,7 @@ pop(Client *c)
|
|||||||
focus(c);
|
focus(c);
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
#endif // !ZOOMSWAP_PATCH
|
||||||
|
|
||||||
void
|
void
|
||||||
propertynotify(XEvent *e)
|
propertynotify(XEvent *e)
|
||||||
@ -2506,14 +2510,66 @@ void
|
|||||||
zoom(const Arg *arg)
|
zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
Client *c = selmon->sel;
|
Client *c = selmon->sel;
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
|
Client *at = NULL, *cold, *cprevious = NULL, *p;
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
||||||
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange
|
if (!selmon->lt[selmon->sellt]->arrange
|
||||||
|| (selmon->sel && selmon->sel->isfloating))
|
|| (selmon->sel && selmon->sel->isfloating)
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
|
|| !c
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
|
if (c == nexttiled(selmon->clients)) {
|
||||||
|
#if PERTAG_PATCH
|
||||||
|
p = selmon->pertag->prevzooms[selmon->pertag->curtag];
|
||||||
|
#else
|
||||||
|
p = prevzoom;
|
||||||
|
#endif // PERTAG_PATCH
|
||||||
|
at = prevtiled(p);
|
||||||
|
if (at)
|
||||||
|
cprevious = nexttiled(at->next);
|
||||||
|
if (!cprevious || cprevious != p) {
|
||||||
|
#if PERTAG_PATCH
|
||||||
|
selmon->pertag->prevzooms[selmon->pertag->curtag] = NULL;
|
||||||
|
#else
|
||||||
|
prevzoom = NULL;
|
||||||
|
#endif // PERTAG_PATCH
|
||||||
|
if (!c || !(c = nexttiled(c->next)))
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
c = cprevious;
|
||||||
|
}
|
||||||
|
|
||||||
|
cold = nexttiled(selmon->clients);
|
||||||
|
if (c != cold && !at)
|
||||||
|
at = prevtiled(c);
|
||||||
|
detach(c);
|
||||||
|
attach(c);
|
||||||
|
/* swap windows instead of pushing the previous one down */
|
||||||
|
if (c != cold && at) {
|
||||||
|
#if PERTAG_PATCH
|
||||||
|
selmon->pertag->prevzooms[selmon->pertag->curtag] = cold;
|
||||||
|
#else
|
||||||
|
prevzoom = cold;
|
||||||
|
#endif // PERTAG_PATCH
|
||||||
|
if (cold && at != cold) {
|
||||||
|
detach(cold);
|
||||||
|
cold->next = at->next;
|
||||||
|
at->next = cold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
focus(c);
|
||||||
|
arrange(c->mon);
|
||||||
|
#else
|
||||||
if (c == nexttiled(selmon->clients))
|
if (c == nexttiled(selmon->clients))
|
||||||
if (!c || !(c = nexttiled(c->next)))
|
if (!c || !(c = nexttiled(c->next)))
|
||||||
return;
|
return;
|
||||||
pop(c);
|
pop(c);
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -9,3 +9,7 @@
|
|||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
#include "systray.c"
|
#include "systray.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
|
#include "zoomswap.c"
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
||||||
|
@ -5,3 +5,7 @@
|
|||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
|
#include "zoomswap.h"
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
@ -7,5 +7,7 @@ struct Pertag {
|
|||||||
#if PERTAGBAR_PATCH
|
#if PERTAGBAR_PATCH
|
||||||
Bool showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
Bool showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||||
#endif // PERTAGBAR_PATCH
|
#endif // PERTAGBAR_PATCH
|
||||||
|
#if ZOOMSWAP_PATCH
|
||||||
Client *prevzooms[LENGTH(tags) + 1]; /* store zoom information */
|
Client *prevzooms[LENGTH(tags) + 1]; /* store zoom information */
|
||||||
|
#endif // ZOOMSWAP_PATCH
|
||||||
};
|
};
|
13
patch/zoomswap.c
Normal file
13
patch/zoomswap.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#if !PERTAG_PATCH
|
||||||
|
static Client *prevzoom = NULL;
|
||||||
|
#endif // PERTAG_PATCH
|
||||||
|
|
||||||
|
Client *
|
||||||
|
prevtiled(Client *c) {
|
||||||
|
Client *p;
|
||||||
|
if (!c || c == c->mon->clients)
|
||||||
|
return NULL;
|
||||||
|
for (p = c->mon->clients; p && p->next != c; p = p->next);
|
||||||
|
return p;
|
||||||
|
}
|
1
patch/zoomswap.h
Normal file
1
patch/zoomswap.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
static Client *prevtiled(Client *c);
|
@ -27,3 +27,9 @@
|
|||||||
* tag basis, or leave it as one bar per monitor.
|
* tag basis, or leave it as one bar per monitor.
|
||||||
*/
|
*/
|
||||||
#define PERTAGBAR_PATCH 0
|
#define PERTAGBAR_PATCH 0
|
||||||
|
|
||||||
|
/* The zoomswap patch allows a master and a stack window to swap places
|
||||||
|
* rather than every window on the screen changing position.
|
||||||
|
* https://dwm.suckless.org/patches/zoomswap/
|
||||||
|
*/
|
||||||
|
#define ZOOMSWAP_PATCH 0
|
Loading…
Reference in New Issue
Block a user