ru_gaps Patch

- Add ru_gaps patch
- Increase border size to 3 pixels
- Set default gap size to 10 pixels
- Update README to include ru_gaps patch link & modifications
- Update man page to include keybindings for ru_gaps
This commit is contained in:
Sravan Balaji
2020-08-29 15:14:22 -04:00
parent 81f908b5c6
commit 3047114a1f
4 changed files with 59 additions and 15 deletions

View File

@@ -54,13 +54,15 @@ and (re)compiling the source code.
* [combo](https://dwm.suckless.org/patches/combo/)
* [movestack](https://dwm.suckless.org/patches/movestack/)
* [systray](https://dwm.suckless.org/patches/systray/)
* [ru_gaps](https://dwm.suckless.org/patches/ru_gaps/)
### Modifications
* Change mod key to super key (windows key)
* Change terminal from st to alacritty
* Change colors to follow [Dracula](https://draculatheme.com) theme
* Increase border to 2 pixels
* Increase border to 3 pixels
* Set default gap size to 10 pixels
* Change tags to be [Font Awesome](https://fontawesome.com) icons
* Run programs and processes on autostart
* [Pulse Audio Volume Control](https://gist.github.com/palopezv/efd34059af6126ad970940bcc6a90f2e)

View File

@@ -5,7 +5,8 @@
#include "movestack.c"
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int borderpx = 3; /* border pixel of windows */
static const int gappx = 10; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2; /* systray spacing */
@@ -111,6 +112,9 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
{ MODKEY, XK_minus, setgaps, {.i = -5 } },
{ MODKEY, XK_equal, setgaps, {.i = +5 } },
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvolcmd} },
{ 0, XF86XK_AudioMute, spawn, {.v = mutevolcmd} },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvolcmd} },

9
dwm.1
View File

@@ -104,6 +104,15 @@ Send focused window to previous screen, if any.
.B Mod1\-Shift\-.
Send focused window to next screen, if any.
.TP
.B Mod1\--
Decrease window gap.
.TP
.B Mod1\-=
Increase window gap.
.TP
.B Mod1\-Shift\-=
Reset window gap to 0.
.TP
.B Mod1\-b
Toggles bar on and off.
.TP

55
dwm.c
View File

@@ -138,6 +138,7 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
int gappx; /* gaps between windows */
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@@ -230,6 +231,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
@@ -775,6 +777,7 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
m->gappx = gappx;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1486,6 +1489,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
wc.border_width = c->bw;
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|| &monocle == c->mon->lt[c->mon->sellt]->arrange))
{
c->w = wc.width += c->bw * 2;
c->h = wc.height += c->bw * 2;
wc.border_width = 0;
}
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
@@ -1771,6 +1781,16 @@ setfullscreen(Client *c, int fullscreen)
}
}
void
setgaps(const Arg *arg)
{
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
selmon->gappx = 0;
else
selmon->gappx += arg->i;
arrange(selmon);
}
void
setlayout(const Arg *arg)
{
@@ -1954,28 +1974,37 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
unsigned int i, n, h, mw, my, ty;
unsigned int i, n, h, mw, my, ty, ns;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
if(n == 1) {
c = nexttiled(m->clients);
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
return;
}
if (n > m->nmaster)
if (n > m->nmaster) {
mw = m->nmaster ? m->ww * m->mfact : 0;
else
mw = m->ww;
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
ns = m->nmaster > 0 ? 2 : 1;
}
else {
mw = m->ww - m->gappx;
ns = 1;
}
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
resize(c, m->wx + m->gappx, m->wy + my, mw - 2*c->bw - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
if(my + HEIGHT(c) + m->gappx < m->wh)
my += HEIGHT(c) + m->gappx;
} else {
h = (m->wh - ty) / (n - i);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
if (ty + HEIGHT(c) < m->wh)
ty += HEIGHT(c);
h = (m->wh - ty) / (n - i) - m->gappx;
resize(c, m->wx + mw + m->gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - m->gappx*(5-ns)/2, h - 2*c->bw, 0);
if(ty + HEIGHT(c) + m->gappx < m->wh)
ty += HEIGHT(c) + m->gappx;
}
}