Adding setborderpx patch

This commit is contained in:
bakkeby 2019-09-14 23:28:04 +02:00
parent 39e161e545
commit 5501f81b9c
8 changed files with 133 additions and 79 deletions

View File

@ -13,6 +13,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-09-14 - Added setborderpx patch
2019-09-13 - Added titlecolor and push patches
2019-09-12 - Added activetagindicatorbar, alwaysfullscreen and autoresize patches
@ -117,6 +119,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- saves size and position of every floating window before it is forced into tiled mode
- if the window is made floating again then the old dimensions will be restored
- [setborderpx](https://dwm.suckless.org/patches/statuspadding/)
- this patch allows border pixels to be changed during runtime
- [statuspadding](https://dwm.suckless.org/patches/statuspadding/)
- adds configuration options for horizontal and vertical padding in the status bar

View File

@ -313,6 +313,11 @@ static Key keys[] = {
#if ALTERNATIVE_TAGS_PATCH
{ MODKEY, XK_n, togglealttag, {0} },
#endif // ALTERNATIVE_TAGS_PATCH
#if SETBORDERPX_PATCH
{ MODKEY|ShiftMask, XK_minus, setborderpx, {.i = -1 } },
{ MODKEY|ShiftMask, XK_plus, setborderpx, {.i = +1 } },
{ MODKEY|ShiftMask, XK_numbersign, setborderpx, {.i = 0 } },
#endif // SETBORDERPX_PATCH
#if CYCLELAYOUTS_PATCH
{ MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },

10
dwm.c
View File

@ -180,6 +180,9 @@ struct Monitor {
int gappoh; /* horizontal outer gaps */
int gappov; /* vertical outer gaps */
#endif // VANITYGAPS_PATCH
#if SETBORDERPX_PATCH
unsigned int borderpx;
#endif // SETBORDERPX_PATCH
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@ -888,6 +891,9 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
#if SETBORDERPX_PATCH
m->borderpx = borderpx;
#endif // SETBORDERPX_PATCH
#if VANITYGAPS_PATCH
m->gappih = gappih;
m->gappiv = gappiv;
@ -1568,7 +1574,11 @@ manage(Window w, XWindowAttributes *wa)
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
#if SETBORDERPX_PATCH
c->bw = c->mon->borderpx;
#else
c->bw = borderpx;
#endif // SETBORDERPX_PATCH
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);

View File

@ -48,6 +48,10 @@
#include "rotatestack.c"
#endif
#if SETBORDERPX_PATCH
#include "setborderpx.c"
#endif
#if SYSTRAY_PATCH
#include "systray.c"
#endif

View File

@ -44,6 +44,10 @@
#include "rotatestack.h"
#endif
#if SETBORDERPX_PATCH
#include "setborderpx.h"
#endif
#if SYSTRAY_PATCH
#include "systray.h"
#endif

20
patch/setborderpx.c Normal file
View File

@ -0,0 +1,20 @@
void
setborderpx(const Arg *arg)
{
Client *c;
if (arg->i == 0)
mons->borderpx = borderpx;
else if (mons->borderpx + arg->i < 0)
mons->borderpx = 0;
else
mons->borderpx += arg->i;
for (c = mons->clients; c; c = c->next)
if (c->bw + arg->i < 0)
c->bw = mons->borderpx = 0;
else
c->bw = mons->borderpx;
arrange(selmon);
}

1
patch/setborderpx.h Normal file
View File

@ -0,0 +1 @@
static void setborderpx(const Arg *arg);

View File

@ -187,6 +187,11 @@
*/
#define SAVEFLOATS_PATCH 0
/* This patch allows border pixels to be changed during runtime.
* https://dwm.suckless.org/patches/setborderpx/
*/
#define SETBORDERPX_PATCH 0
/* This patch adds configuration options for horizontal and vertical padding in the status bar.
* https://dwm.suckless.org/patches/statuspadding/
*/