Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/chadwm/config.def.h b/chadwm/config.def.h
- index 72a34eb..2d26eca 100644
- --- a/chadwm/config.def.h
- +++ b/chadwm/config.def.h
- @@ -9,6 +9,8 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails,display s
- static const int showsystray = 1; /* 0 means no systray */
- static const int showbar = 1; /* 0 means no bar */
- static const int topbar = 1; /* 0 means bottom bar */
- +static const int vertpad = 10; /* vertical padding of bar */
- +static const int sidepad = 10; /* horizontal padding of bar */
- static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
- static const int horizpadbar = 10;
- static const int vertpadbar = 10;
- diff --git a/chadwm/dwm.c b/chadwm/dwm.c
- index 06798c6..50f473f 100644
- --- a/chadwm/dwm.c
- +++ b/chadwm/dwm.c
- @@ -291,6 +291,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 vp; /* vertical padding for bar */
- +static int sp; /* side padding for bar */
- static int (*xerrorxlib)(Display *, XErrorEvent *);
- static unsigned int numlockmask = 0;
- static void (*handler[LASTEvent]) (XEvent *) = {
- @@ -863,8 +865,8 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
- text = p;
- w += horizpadbar;
- - ret = x = m->ww - borderpx - w;
- - x = m->ww - borderpx - w - getsystraywidth();
- + ret = x = m->ww - sp * 2 - borderpx - w;
- + x = m->ww - sp * 2 - borderpx - w - getsystraywidth();
- drw_setscheme(drw, scheme[LENGTH(colors)]);
- drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
- @@ -1236,14 +1238,14 @@ drawbar(Monitor *m)
- {
- int x, y = borderpx, w, sw = 0, stw = 0;
- int th = bh - borderpx * 2;
- - int mw = m->ww - borderpx * 2;
- + int mw = m->ww - sp * 2 - borderpx * 2;
- int boxs = drw->fonts->h / 9;
- int boxw = drw->fonts->h / 6 + 2;
- unsigned int i, occ = 0, urg = 0;
- Client *c;
- XSetForeground(drw->dpy, drw->gc, clrborder.pixel);
- - XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww, bh);
- + XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, m->ww - sp * 2, bh);
- if(showsystray && m == systraytomon(m))
- @@ -1275,14 +1277,14 @@ drawbar(Monitor *m)
- drw_setscheme(drw, scheme[SchemeNorm]);
- x = drw_text(drw, x, y, w, th, lrpad / 2, m->ltsymbol, 0);
- - if ((w = mw - sw - stw - x) > th) {
- + if ((w = mw + sp * 2 - sw - stw - x) > th) {
- if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- if (m->sel->isfloating)
- drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0);
- } else {
- drw_setscheme(drw, scheme[SchemeNorm]);
- - drw_rect(drw, x, y, w, th, 1, 1);
- + drw_rect(drw, x, y, w - sp * 2, th, 1, 1);
- }
- }
- drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
- @@ -1890,10 +1892,10 @@ resize(Client *c, int x, int y, int w, int h, int interact)
- void
- resizebarwin(Monitor *m) {
- - unsigned int w = m->ww;
- + unsigned int w = m->ww - 2 * sp;
- if (showsystray && m == systraytomon(m))
- w -= getsystraywidth();
- - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
- + XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, w, bh);
- }
- void
- @@ -2253,6 +2255,8 @@ setup(void)
- lrpad = drw->fonts->h;
- bh = user_bh ? user_bh : drw->fonts->h + 2 + vertpadbar + borderpx * 2;
- updategeom();
- + sp = sidepad;
- + vp = (topbar == 1) ? vertpad : - vertpad;
- /* init atoms */
- utf8string = XInternAtom(dpy, "UTF8_STRING", False);
- wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
- @@ -2292,6 +2296,7 @@ setup(void)
- /* init bars */
- 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,
- @@ -2546,7 +2551,7 @@ updatebars(void)
- w = m->ww;
- if (showsystray && m == systraytomon(m))
- w -= getsystraywidth();
- - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
- + m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, w - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
- XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
- @@ -2563,11 +2568,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 + vp : m->wy;
- } else
- - m->by = -bh;
- + m->by = -bh - vp;
- }
- void
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement