Adding option to enable gaps for monocle layout, ref. issue #11

pull/32/head
bakkeby 4 years ago
parent e75decf7de
commit 58ab50845d

@ -545,13 +545,13 @@ flextile(Monitor *m)
if (n == 0) if (n == 0)
return; return;
#if VANITYGAPS_PATCH #if VANITYGAPS_PATCH && !VANITYGAPS_MONOCLE_PATCH
/* No outer gap if full screen monocle */ /* No outer gap if full screen monocle */
if (abs(m->ltaxis[MASTER]) == MONOCLE && (abs(m->ltaxis[LAYOUT]) == NO_SPLIT || n <= m->nmaster)) { if (abs(m->ltaxis[MASTER]) == MONOCLE && (abs(m->ltaxis[LAYOUT]) == NO_SPLIT || n <= m->nmaster)) {
oh = 0; oh = 0;
ov = 0; ov = 0;
} }
#endif // VANITYGAPS_PATCH #endif // VANITYGAPS_PATCH && !VANITYGAPS_MONOCLE_PATCH
(&flexlayouts[abs(m->ltaxis[LAYOUT])])->arrange(m, m->wx + ov, m->wy + oh, m->wh - 2*oh, m->ww - 2*ov, ih, iv, n); (&flexlayouts[abs(m->ltaxis[LAYOUT])])->arrange(m, m->wx + ov, m->wy + oh, m->wh - 2*oh, m->ww - 2*ov, ih, iv, n);
return; return;

@ -1,3 +1,21 @@
#if VANITYGAPS_PATCH && VANITYGAPS_MONOCLE_PATCH
void
monocle(Monitor *m)
{
unsigned int n;
int oh, ov, ih, iv;
Client *c;
getgaps(m, &oh, &ov, &ih, &iv, &n);
#if !MONOCLESYMBOL_PATCH
if (n > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
#endif // MONOCLESYMBOL_PATCH
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
resize(c, m->wx + ov, m->wy + oh, m->ww - 2 * c->bw - 2 * ov, m->wh - 2 * c->bw - 2 * oh, 0);
}
#else
void void
monocle(Monitor *m) monocle(Monitor *m)
{ {
@ -15,4 +33,5 @@ monocle(Monitor *m)
#endif // MONOCLESYMBOL_PATCH #endif // MONOCLESYMBOL_PATCH
for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
} }
#endif // VANITYGAPS_PATCH

@ -112,7 +112,7 @@ incrivgaps(const Arg *arg)
); );
} }
#if CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || FIBONACCI_DWINDLE_LAYOUT || FIBONACCI_SPIRAL_LAYOUT || GAPPLESSGRID_LAYOUT || NROWGRID_LAYOUT || HORIZGRID_LAYOUT || BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || GRIDMODE_LAYOUT || FLEXTILE_DELUXE_LAYOUT || TILE_LAYOUT #if CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || FIBONACCI_DWINDLE_LAYOUT || FIBONACCI_SPIRAL_LAYOUT || GAPPLESSGRID_LAYOUT || NROWGRID_LAYOUT || HORIZGRID_LAYOUT || BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || GRIDMODE_LAYOUT || FLEXTILE_DELUXE_LAYOUT || TILE_LAYOUT || (VANITYGAPS_MONOCLE_PATCH && MONOCLE_LAYOUT)
static void static void
getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
{ {

@ -10,7 +10,7 @@ static void incrivgaps(const Arg *arg);
static void togglegaps(const Arg *arg); static void togglegaps(const Arg *arg);
/* Internals */ /* Internals */
#if CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || FIBONACCI_DWINDLE_LAYOUT || FIBONACCI_SPIRAL_LAYOUT || GAPPLESSGRID_LAYOUT || NROWGRID_LAYOUT || HORIZGRID_LAYOUT || BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || GRIDMODE_LAYOUT || FLEXTILE_DELUXE_LAYOUT || TILE_LAYOUT #if CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || FIBONACCI_DWINDLE_LAYOUT || FIBONACCI_SPIRAL_LAYOUT || GAPPLESSGRID_LAYOUT || NROWGRID_LAYOUT || HORIZGRID_LAYOUT || BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || GRIDMODE_LAYOUT || FLEXTILE_DELUXE_LAYOUT || TILE_LAYOUT || (VANITYGAPS_MONOCLE_PATCH && MONOCLE_LAYOUT)
static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc); static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc);
#endif #endif
static void setgaps(int oh, int ov, int ih, int iv); static void setgaps(int oh, int ov, int ih, int iv);

@ -580,6 +580,12 @@
*/ */
#define VANITYGAPS_PATCH 0 #define VANITYGAPS_PATCH 0
/* This patch adds outer gaps for the monocle layout.
* Most gaps patches tries to avoid gaps on the monocle layout, as it is often used as a
* fullscreen mode, hence this is enabled separately from the main vanitygaps patch.
*/
#define VANITYGAPS_MONOCLE_PATCH 0
/* Follow a window to the tag it is being moved to. /* Follow a window to the tag it is being moved to.
* https://dwm.suckless.org/patches/viewontag/ * https://dwm.suckless.org/patches/viewontag/
*/ */

Loading…
Cancel
Save