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

@ -225,107 +225,112 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont,
static const char *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
#if ROTATESTACK_PATCH
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
#endif // ROTATESTACK_PATCH
#if PUSH_PATCH
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
#endif // PUSH_PATCH
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
#if CFACTS_PATCH
{ MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
{ MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
#endif // CFACTS_PATCH
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Return, zoom, {0} },
#if VANITYGAPS_PATCH
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
#endif // VANITYGAPS_PATCH
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_Tab, view, {0} },
#if AWESOMEBAR_PATCH
{ MODKEY, XK_z, showhideclient, {0} },
{ MODKEY, XK_z, showhideclient, {0} },
#endif // AWESOMEBAR_PATCH
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
#if FLEXTILE_LAYOUT
{ MODKEY, XK_w, setflexlayout, {.i = 293 } }, // centered master
{ MODKEY, XK_e, setflexlayout, {.i = 273 } }, // bstackhoriz layout
{ MODKEY, XK_r, setflexlayout, {.i = 272 } }, // bstack layout
{ MODKEY, XK_v, setflexlayout, {.i = 261 } }, // default tile layout
{ MODKEY, XK_g, setflexlayout, {.i = 263 } }, // tile + grid layout
{ MODKEY|ControlMask, XK_w, setflexlayout, {.i = 7 } }, // grid
{ MODKEY|ControlMask, XK_e, setflexlayout, {.i = 262 } }, // deck layout
{ MODKEY|ControlMask, XK_r, setflexlayout, {.i = 6 } }, // monocle
{ MODKEY|ControlMask, XK_g, setflexlayout, {.i = 257 } }, // columns (col) layout
{ MODKEY|ControlMask, XK_t, rotatelayoutaxis, {.i = 0 } }, /* flextile, 0 = layout axis */
{ MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1 } }, /* flextile, 1 = master axis */
{ MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2 } }, /* flextile, 2 = stack axis */
{ MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */
{ MODKEY, XK_w, setflexlayout, {.i = 293 } }, // centered master
{ MODKEY, XK_e, setflexlayout, {.i = 273 } }, // bstackhoriz layout
{ MODKEY, XK_r, setflexlayout, {.i = 272 } }, // bstack layout
{ MODKEY, XK_v, setflexlayout, {.i = 261 } }, // default tile layout
{ MODKEY, XK_g, setflexlayout, {.i = 263 } }, // tile + grid layout
{ MODKEY|ControlMask, XK_w, setflexlayout, {.i = 7 } }, // grid
{ MODKEY|ControlMask, XK_e, setflexlayout, {.i = 262 } }, // deck layout
{ MODKEY|ControlMask, XK_r, setflexlayout, {.i = 6 } }, // monocle
{ MODKEY|ControlMask, XK_g, setflexlayout, {.i = 257 } }, // columns (col) layout
{ MODKEY|ControlMask, XK_t, rotatelayoutaxis, {.i = 0 } }, /* flextile, 0 = layout axis */
{ MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1 } }, /* flextile, 1 = master axis */
{ MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2 } }, /* flextile, 2 = stack axis */
{ MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */
#endif // FLEXTILE_LAYOUT
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
#if TOGGLEFULLSCREEN_PATCH
{ MODKEY, XK_y, togglefullscreen, {0} },
{ MODKEY, XK_y, togglefullscreen, {0} },
#endif // TOGGLEFULLSCREEN_PATCH
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
#if TAGALLMON_PATCH
{ MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
#endif // TAGALLMON_PATCH
#if TAGSWAPMON_PATCH
{ MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
#endif // TAGSWAPMON_PATCH
#if ALTERNATIVE_TAGS_PATCH
{ MODKEY, XK_n, togglealttag, {0} },
{ 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 } },
{ MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
#endif // CYCLELAYOUTS_PATCH
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
};
/* button definitions */

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/
*/