You could always add in a conditional to make sure this situation never arises. Especially in tiling mode, ‘accidentally’ spawning too many windows could crash the window manager and all other running X applications with it.
> On 8 Apr 2019, at 11:01, Enan Ajmain <3nan.ajm...@gmail.com> wrote: > > Thanks, deruzen. > > About the part about 2*gappx exceeding width or height : In my case at > least, it shouldn't be a problem. I use 2 personal computers and dwm > needs to be built personally when installing. So, I need to set up the > value of gappx manually anyway. > >> On Mon, Apr 8, 2019 at 2:14 AM deurzen <devr...@gmail.com> wrote: >> >> Nothing wrong with that. Only situation in which this would crash is if >> 2*gappx exceeds the width or height of the tiled area, obviously. >> >>> On 7 Apr 2019, at 16:15, Enan Ajmain <3nan.ajm...@gmail.com> wrote: >>> >>> Hi, >>> I am using dwm-tilegap-6.2 patch to get gaps around windows. But the >>> gaps only show in tiling mode. I assumed that similar support for >>> monocle mode could be easily hacked. Now, I changed the monocle >>> function in `dwm.c` in the following way. >>> >>> ``` >>> void >>> monocle(Monitor *m) >>> { >>> unsigned int n = 0; >>> Client *c; >>> >>> for (c = m->clients; c; c = c->next) >>> if (ISVISIBLE(c)) >>> n++; >>> if (n > 0) /* override layout symbol */ >>> snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); >>> for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) >>> resize(c, m->wx + gappx, m->wy + gappx, m->ww - 2 * c->bw - 2 * gappx, >>> m->wh - 2 * c->bw - 2 * gappx, 0); >>> } >>> ``` >>> >>> You will see that the only change I have made is adding `gappx` amount >>> of space to both `m->wx` and `m->wy` and subtracting `2 * gappx` >>> amount of space from both `m->ww` and `m->wh`. It's very simple stuff. >>> But due to my lack of experience, I wanted to make sure whether this >>> will be in any way harmful. I don't want my window manager to crash >>> when I need it. So, if someone could point out the faults if any, it >>> would be much appreciated. >>> >>> Thanks, >>> Enan Ajmain >>> >> >