Merge pull request #5 from nagbalae/development

Added vanity-gapps & changed dwm.1
This commit is contained in:
Bazsi 2020-06-17 16:06:16 +02:00 committed by GitHub
commit 121425dccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 158 additions and 40 deletions

View File

@ -7,7 +7,13 @@ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 0; /* 0 means bottom bar */ static const int topbar = 0; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=8" }; static const char *fonts[] = { "monospace:size=8" };
static const char dmenufont[] = "monospace:size=8"; static const char dmenufont[] = "monospace:size=8";
/* gapps */
static const unsigned int gappih = 10; /* horiz inner gap between windows */
static const unsigned int gappiv = 10; /* vert inner gap between windows */
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */
/* colours */
static char normbgcolor[] = "#222222"; static char normbgcolor[] = "#222222";
static char normbordercolor[] = "#444444"; static char normbordercolor[] = "#444444";
static char normfgcolor[] = "#bbbbbb"; static char normfgcolor[] = "#bbbbbb";
@ -112,6 +118,15 @@ static Key keys[] = {
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5") },
{ 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") }, { 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") },
/*gapps*/
{ MODKEY|ControlMask, XK_k, incrgaps, {.i = +2 } },
{ MODKEY|ControlMask, XK_j, incrgaps, {.i = -2 } },
{ MODKEY|ControlMask|ShiftMask, XK_k, incrogaps, {.i = +2 } },
{ MODKEY|ControlMask|ShiftMask, XK_j, incrogaps, {.i = -2 } },
{ MODKEY|ControlMask|ShiftMask, XK_h, incrigaps, {.i = +2 } },
{ MODKEY|ControlMask|ShiftMask, XK_l, incrigaps, {.i = -2 } },
{ MODKEY|ControlMask, XK_0, togglegaps, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_0, defaultgaps, {0} },
}; };
/* button definitions */ /* button definitions */

32
dwm.1
View File

@ -1,6 +1,6 @@
.TH DWM 1 dwm\-VERSION .TH DWM 1 dwm\-VERSION
.SH NAME .SH NAME
dwm \- dynamic window manager (Luke Smith <https://lukesmith.xyz>'s build) dwm \- dynamic window manager (nagbalae's build)
.SH SYNOPSIS .SH SYNOPSIS
.B dwm .B dwm
.RB [ \-v ] .RB [ \-v ]
@ -23,17 +23,6 @@ before the windows title. The selected tags are indicated with a different
color. The tags of the focused window are indicated with a filled square in the color. The tags of the focused window are indicated with a filled square in the
top left corner. The tags which are applied to one or more windows are top left corner. The tags which are applied to one or more windows are
indicated with an empty square in the top left corner. indicated with an empty square in the top left corner.
.P
dwm draws a small border around windows to indicate the focus state.
.P
.I
libxft-bgra
should be installed for this build of dwm. Arch users may install it via the
AUR. Color characters and emoji are enabled, but these will cause crashes
without the fix
.I
libxft-bgra
offers.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-v .B \-v
@ -62,7 +51,7 @@ click on a tag label adds/removes that tag to/from the focused window.
.TP .TP
.B Super\-Return .B Super\-Return
Start terminal, Start terminal,
.BR st(1). .BR $TERM.
.TP .TP
.B Super\-d .B Super\-d
Spawn Spawn
@ -75,24 +64,12 @@ Toggles bar on and off.
.B Super\-q .B Super\-q
Close focused window. Close focused window.
.TP .TP
.B Super\-t/T
Sets tiled/bstack layouts.
.TP
.B Super\-f .B Super\-f
Toggle fullscreen window. Toggle fullscreen window.
.TP .TP
.B Super\-F .B Super\-F
Toggle floating layout. Toggle floating layout.
.TP .TP
.B Super\-y/Y
Sets Fibonacci spiral/dwinde layouts.
.TP
.B Super\-u/U
Sets centered master layout.
.TP
.B Super\-i/I
Sets centered master or floating master layouts.
.TP
.B Super\-space .B Super\-space
Zooms/cycles focused window to/from master area. Zooms/cycles focused window to/from master area.
.TP .TP
@ -135,11 +112,8 @@ View all windows with any tag.
.B Super\-Control\-[1..n] .B Super\-Control\-[1..n]
Add/remove all windows with nth tag to/from the view. Add/remove all windows with nth tag to/from the view.
.TP .TP
.B Super\-Shift\-q .B Super\-Shift\-Escape
Quit dwm. Quit dwm.
.TP
.B Mod1\-Control\-Shift\-q
Menu to refresh/quit/reboot/shutdown.
.SS Mouse commands .SS Mouse commands
.TP .TP
.B Super\-Left click .B Super\-Left click

149
dwm.c
View File

@ -136,6 +136,10 @@ struct Monitor {
int by; /* bar geometry */ int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */ int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */ int wx, wy, ww, wh; /* window area */
int gappih; /* horizontal gap between windows */
int gappiv; /* vertical gap between windows */
int gappoh; /* horizontal outer gaps */
int gappov; /* vertical outer gaps */
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
unsigned int tagset[2]; unsigned int tagset[2];
@ -217,6 +221,16 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state); static void setclientstate(Client *c, long state);
static void setfocus(Client *c); static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setgaps(int oh, int ov, int ih, int iv);
static void incrgaps(const Arg *arg);
static void incrigaps(const Arg *arg);
static void incrogaps(const Arg *arg);
static void incrohgaps(const Arg *arg);
static void incrovgaps(const Arg *arg);
static void incrihgaps(const Arg *arg);
static void incrivgaps(const Arg *arg);
static void togglegaps(const Arg *arg);
static void defaultgaps(const Arg *arg);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
@ -259,6 +273,7 @@ static char stext[256];
static int screen; static int screen;
static int sw, sh; /* X display screen geometry width, height */ static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */ static int bh, blw = 0; /* bar geometry */
static int enablegaps = 1; /* enables gaps, used by togglegaps */
static int lrpad; /* sum of left and right padding for text */ static int lrpad; /* sum of left and right padding for text */
static int (*xerrorxlib)(Display *, XErrorEvent *); static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0; static unsigned int numlockmask = 0;
@ -656,6 +671,10 @@ createmon(void)
m->nmaster = nmaster; m->nmaster = nmaster;
m->showbar = showbar; m->showbar = showbar;
m->topbar = topbar; m->topbar = topbar;
m->gappih = gappih;
m->gappiv = gappiv;
m->gappoh = gappoh;
m->gappov = gappov;
m->lt[0] = &layouts[0]; m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)]; m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@ -1545,6 +1564,110 @@ setfullscreen(Client *c, int fullscreen)
arrange(c->mon); arrange(c->mon);
} }
} }
void
setgaps(int oh, int ov, int ih, int iv)
{
if (oh < 0) oh = 0;
if (ov < 0) ov = 0;
if (ih < 0) ih = 0;
if (iv < 0) iv = 0;
selmon->gappoh = oh;
selmon->gappov = ov;
selmon->gappih = ih;
selmon->gappiv = iv;
arrange(selmon);
}
void
togglegaps(const Arg *arg)
{
enablegaps = !enablegaps;
arrange(selmon);
}
void
defaultgaps(const Arg *arg)
{
setgaps(gappoh, gappov, gappih, gappiv);
}
void
incrgaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov + arg->i,
selmon->gappih + arg->i,
selmon->gappiv + arg->i
);
}
void
incrigaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih + arg->i,
selmon->gappiv + arg->i
);
}
void
incrogaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov + arg->i,
selmon->gappih,
selmon->gappiv
);
}
void
incrohgaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov,
selmon->gappih,
selmon->gappiv
);
}
void
incrovgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov + arg->i,
selmon->gappih,
selmon->gappiv
);
}
void
incrihgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih + arg->i,
selmon->gappiv
);
}
void
incrivgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih,
selmon->gappiv + arg->i
);
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
@ -1722,26 +1845,32 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
unsigned int i, n, h, mw, my, ty; unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
Client *c; Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0) if (n == 0)
return; return;
if (smartgaps == n) {
oe = 0; // outer gaps disabled
}
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0; mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0;
else else
mw = m->ww; mw = m->ww - 2*m->gappov*oe + m->gappiv*ie;
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) { if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i); r = MIN(n, m->nmaster) - i;
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
my += HEIGHT(c); resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0);
my += HEIGHT(c) + m->gappih*ie;
} else { } else {
h = (m->wh - ty) / (n - i); r = n - i;
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
ty += HEIGHT(c); resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0);
ty += HEIGHT(c) + m->gappih*ie;
} }
} }