From c811f7d8375d7ee76b51f4a365de58170f2bb90b Mon Sep 17 00:00:00 2001 From: Sascha Paunovic Date: Mon, 4 Jun 2018 21:21:59 +0200 Subject: [PATCH] new config + uselessgap --- config.h | 11 ++++++----- dwm.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/config.h b/config.h index 3cd0897..7aafe7c 100644 --- a/config.h +++ b/config.h @@ -15,8 +15,8 @@ static const char selfgcolor[] = "#eeeeee"; static unsigned int baralpha = 0xa0; static unsigned int borderalpha = OPAQUE; static const char normbordercolor[] = "#444444"; -static const char *fonts[] = { "Misc TamzenForPowerline:pixelsize=15" }; -static const char dmenufont[] = "Misc TamzenForPowerline:pixelsize=15"; +static const char *fonts[] = { "xos4 Terminus:pixelsize=15" }; +static const char dmenufont[] = "xos4 Terminus:pixelsize=15"; static const char col_gray1[] = "#222222"; static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; @@ -61,9 +61,10 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenu, manipulated in spawn() */ static const char *dmenucmd[] = {"dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *passmenucmd[] = {"passmenu", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +//static const char *passmenucmd[] = {"/usr/share/pass/dmenu/passmenu", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *zath[] = {"zathura", NULL }; static const char *term[] = {"st", NULL }; -static const char *brow[] = {"chromium-browser", NULL }; +static const char *brow[] = {"firefox", NULL }; static const char *play[] = {"mpc", "play", NULL }; static const char *stop[] = {"mpc", "stop", NULL}; static const char *next[] = {"mpc", "next", NULL}; @@ -77,7 +78,7 @@ static const char *rais[] = {"amixer", "-q", "sset", "Master", "5%+", NULL}; static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_p, spawn, {.v = passmenucmd } }, + { MODKEY|ShiftMask, XK_r, spawn, {.v = zath } }, { MODKEY|ShiftMask, XK_b, spawn, {.v = brow } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = term } }, { MODKEY|ShiftMask, XK_x, spawn, {.v = lock } }, diff --git a/dwm.c b/dwm.c index 78dc4e9..fd34506 100644 --- a/dwm.c +++ b/dwm.c @@ -51,8 +51,8 @@ #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) -#define WIDTH(X) ((X)->w + 2 * (X)->bw) -#define HEIGHT(X) ((X)->h + 2 * (X)->bw) +#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) +#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx) #define TAGMASK ((1 << LENGTH(tags)) - 1) #define TEXTW(X) (drw_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h) @@ -1309,12 +1309,36 @@ void resizeclient(Client *c, int x, int y, int w, int h) { XWindowChanges wc; + unsigned int n; + unsigned int gapoffset; + unsigned int gapincr; + Client *nbc; - c->oldx = c->x; c->x = wc.x = x; - c->oldy = c->y; c->y = wc.y = y; - c->oldw = c->w; c->w = wc.width = w; - c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; + + /* Get number of clients for the selected monitor */ + for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++); + + /* Do nothing if layout is floating */ + if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) { + gapincr = gapoffset = 0; + } else { + /* Remove border and gap if layout is monocle or only one client */ + if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) { + gapoffset = 0; + gapincr = -2 * borderpx; + wc.border_width = 0; + } else { + gapoffset = gappx; + gapincr = 2 * gappx; + } + } + + c->oldx = c->x; c->x = wc.x = x + gapoffset; + c->oldy = c->y; c->y = wc.y = y + gapoffset; + c->oldw = c->w; c->w = wc.width = w - gapincr; + c->oldh = c->h; c->h = wc.height = h - gapincr; + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); -- 2.11.4.GIT