mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Add PERMON_VANITYGAPS_PATCH (#343)
This commit is contained in:
parent
5e85bc8b5c
commit
58b58dc44e
9
dwm.c
9
dwm.c
@ -482,6 +482,9 @@ struct Monitor {
|
||||
int gappiv; /* vertical gap between windows */
|
||||
int gappoh; /* horizontal outer gaps */
|
||||
int gappov; /* vertical outer gaps */
|
||||
#if PERMON_VANITYGAPS_PATCH
|
||||
int enablegaps; /* whether gaps are enabled */
|
||||
#endif // PERMON_VANITYGAPS_PATCH
|
||||
#endif // VANITYGAPS_PATCH
|
||||
#if SETBORDERPX_PATCH
|
||||
int borderpx;
|
||||
@ -1769,6 +1772,10 @@ createmon(void)
|
||||
}
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
#if PERMON_VANITYGAPS_PATCH
|
||||
m->enablegaps = 1;
|
||||
#endif // PERMON_VANITYGAPS_PATCH
|
||||
|
||||
#if SEAMLESS_RESTART_PATCH
|
||||
restoremonitorstate(m);
|
||||
#endif // SEAMLESS_RESTART_PATCH
|
||||
@ -4651,6 +4658,8 @@ updatebarpos(Monitor *m)
|
||||
#if BAR_PADDING_VANITYGAPS_PATCH && VANITYGAPS_PATCH
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
if (!selmon || selmon->pertag->enablegaps[selmon->pertag->curtag])
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
if (!selmon || selmon->enablegaps)
|
||||
#else
|
||||
if (enablegaps)
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Settings */
|
||||
#if !PERTAG_VANITYGAPS_PATCH
|
||||
#if !(PERTAG_VANITYGAPS_PATCH || PERMON_VANITYGAPS_PATCH)
|
||||
static int enablegaps = 1;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
|
||||
@ -69,10 +69,12 @@ setgapsex(const Arg *arg)
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
if (!selmon->pertag->enablegaps[selmon->pertag->curtag])
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = 1;
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
selmon->enablegaps = 1;
|
||||
#else
|
||||
if (!enablegaps)
|
||||
enablegaps = 1;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
|
||||
setgaps(oh, ov, ih, iv);
|
||||
}
|
||||
@ -83,24 +85,35 @@ togglegaps(const Arg *arg)
|
||||
{
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
selmon->enablegaps = !selmon->enablegaps;
|
||||
#else
|
||||
enablegaps = !enablegaps;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_PADDING_VANITYGAPS_PATCH
|
||||
#if PERMON_VANITYGAPS_PATCH
|
||||
updatebarpos(selmon);
|
||||
for (Bar *bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#else
|
||||
for (Monitor *m = mons; m; m = m->next) {
|
||||
updatebarpos(m);
|
||||
for (Bar *bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
}
|
||||
#endif // PERMON_VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
drawbarwin(systray->bar);
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
#endif // BAR_PADDING_VANITYGAPS_PATCH
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
|
||||
#if (PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH) || PERMON_VANITYGAPS_PATCH
|
||||
arrange(selmon);
|
||||
#else
|
||||
arrange(NULL);
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
}
|
||||
|
||||
static void
|
||||
@ -193,9 +206,11 @@ getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
|
||||
unsigned int n, oe, ie;
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
oe = ie = m->pertag->enablegaps[m->pertag->curtag];
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
oe = ie = m->enablegaps;
|
||||
#else
|
||||
oe = ie = enablegaps;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
|
@ -903,6 +903,11 @@
|
||||
*/
|
||||
#define PERTAG_VANITYGAPS_PATCH 0
|
||||
|
||||
/* This patch allows configuring vanity gaps on a per-monitor basis rather than
|
||||
* all monitors (default).
|
||||
*/
|
||||
#define PERMON_VANITYGAPS_PATCH 0
|
||||
|
||||
/* This controls whether or not to also store bar position on a per
|
||||
* tag basis, or leave it as one bar per monitor.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user