dwm

[fork] dynamic window manager
Log | Files | Refs | README | LICENSE

commit aa4a44681ae25635e61b17439a0ac8a5cfa933d3
parent f99ab2bd5f40e0f81e786753614f89222cb43241
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Sun,  2 Feb 2020 16:49:07 +0000

Bar padding!

Diffstat:
MLICENSE | 1+
Mconfig.h | 4++--
Mdwm.c | 36+++++++++++++++---------------------
3 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -17,6 +17,7 @@ MIT/X Consortium License © 2015-2016 Quentin Rameau <quinq@fifth.space> © 2015-2016 Eric Pruitt <eric.pruitt@gmail.com> © 2016-2017 Markus Teich <markus.teich@stusta.mhn.de> +(C) 2019-Present - Forked by Hayden Hamilton <hayden@haydenvh.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/config.h b/config.h @@ -2,7 +2,7 @@ /* appearance */ static const unsigned int borderpx = 0; /* border pixel of windows */ -static const unsigned int gappx = 7.5; +static const unsigned int gappx = 10; static const unsigned int snap = 1; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ @@ -57,7 +57,7 @@ static const Layout layouts[] = { static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", NULL }; static const char *termcmd[] = { "st", NULL }; -static const char *vimbcmd[] = { "vimb", "--no-maximize", NULL }; +static const char *vimbcmd[] = { "tabbed", "-c", "vimb", "-e", NULL }; static const char *dmpvurlcmd[] = { "dmpvurl", "/tmp/mpv-socket", "/tmp/mpv-socket2", NULL }; static const char *rfeh_[] = { "rfeh", ".wallpapers/", NULL }; static const char *wallblur_[] = { "wallblur", NULL }; diff --git a/dwm.c b/dwm.c @@ -256,6 +256,8 @@ static int screen; static int sw, sh; /* X display screen geometry width, height */ static int bh, blw = 0; /* bar geometry */ static int lrpad; /* sum of left and right padding for text */ +static int sidepad; +static int vertpad; static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0; static void (*handler[LASTEvent]) (XEvent *) = { @@ -550,7 +552,7 @@ configurenotify(XEvent *e) for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); + XMoveResizeWindow(dpy, m->barwin, m->wx + sidepad, m->by + vertpad, m->ww - 2*sidepad, bh); } focus(NULL); arrange(NULL); @@ -814,12 +816,12 @@ drawbar(Monitor *m) if ((w = m->ww - sw - x) > bh) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + drw_text(drw, x, 0, w - 2*sidepad, bh, lrpad / 2, m->sel->name, 0); if (m->sel->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); } else { drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); + drw_rect(drw, x, 0, w - 2*sidepad, bh, 1, 1); } } drw_map(drw, m->barwin, 0, 0, m->ww, bh); @@ -1542,8 +1544,11 @@ setup(void) for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); /* init bars */ + vertpad = gappx; + sidepad = gappx; updatebars(); updatestatus(); + updatebarpos(selmon); /* supporting window for NetWMCheck */ wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, @@ -1662,22 +1667,11 @@ tile(Monitor *m) my += HEIGHT(c) + m->gappx; } else { h = (m->wh - ty) / (n - i) - m->gappx; - resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); + resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - (2*m->gappx), h - (2*c->bw), 0); ty += HEIGHT(c) + m->gappx; } } -/* -void -togglebar(const Arg *arg) -{ - selmon->showbar = !selmon->showbar; - updatebarpos(selmon); - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); - arrange(selmon); -} -*/ - void togglefloating(const Arg *arg) { @@ -1783,7 +1777,7 @@ updatebars(void) for (m = mons; m; m = m->next) { if (m->barwin) continue; - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), + m->barwin = XCreateWindow(dpy, root, m->wx + sidepad, m->by + vertpad, m->ww - 2*sidepad, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); @@ -1798,11 +1792,11 @@ updatebarpos(Monitor *m) m->wy = m->my; m->wh = m->mh; if (m->showbar) { - m->wh -= bh; - m->by = m->topbar ? m->wy : m->wy + m->wh; - m->wy = m->topbar ? m->wy + bh : m->wy; + m->wh = m->wh - vertpad - bh; + m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad; + m->wy = m->topbar ? m->wy + bh + vertpad : m->wy; } else - m->by = -bh; + m->by = -bh - vertpad; } void @@ -2174,7 +2168,7 @@ fibonacci(Monitor *mon, int s) { nw = mon->ww - nw; i++; } - resize(c, nx + mon->gappx, ny + mon->gappx, nw - (2 * c->bw) - 2*mon->gappx, (nh - 2 * c->bw) - 2*mon->gappx, False); + resize(c, nx, ny, nw - (2 * c->bw) - mon->gappx, nh - 2*c->bw - mon->gappx, False); } }