Added barpadding patch
This commit is contained in:
parent
d671b17a32
commit
35d7c78edb
@ -11,6 +11,8 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, disp
|
|||||||
static const int showsystray = 1; /* 0 means no systray */
|
static const int showsystray = 1; /* 0 means no systray */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const int vertpad = 8; /* vertical padding of bar */
|
||||||
|
static const int sidepad = 8; /* horizontal padding of bar */
|
||||||
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||||
static const int vertpadbar = 6; /* vertical padding for statusbar */
|
static const int vertpadbar = 6; /* vertical padding for statusbar */
|
||||||
static const char *fonts[] = { "Hack Nerd Font Mono:size=11" };
|
static const char *fonts[] = { "Hack Nerd Font Mono:size=11" };
|
||||||
|
@ -952,12 +952,14 @@ drawbar(Monitor *m)
|
|||||||
if ((w = m->ww - tw - stw - x) > bh) {
|
if ((w = m->ww - tw - stw - x) > bh) {
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
//drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||||
|
drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
|
||||||
if (m->sel->isfloating)
|
if (m->sel->isfloating)
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||||
} else {
|
} else {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
//drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||||
@ -1551,7 +1553,8 @@ resizebarwin(Monitor *m) {
|
|||||||
unsigned int w = m->ww;
|
unsigned int w = m->ww;
|
||||||
if (showsystray && m == systraytomon(m) && !systrayonleft)
|
if (showsystray && m == systraytomon(m) && !systrayonleft)
|
||||||
w -= getsystraywidth();
|
w -= getsystraywidth();
|
||||||
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
|
//XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
|
||||||
|
XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1940,6 +1943,9 @@ setup(void)
|
|||||||
lrpad = drw->fonts->h + horizpadbar;
|
lrpad = drw->fonts->h + horizpadbar;
|
||||||
bh = drw->fonts->h + vertpadbar;
|
bh = drw->fonts->h + vertpadbar;
|
||||||
updategeom();
|
updategeom();
|
||||||
|
sp = sidepad;
|
||||||
|
vp = (topbar == 1) ? vertpad : - vertpad;
|
||||||
|
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||||
@ -1976,6 +1982,7 @@ setup(void)
|
|||||||
/* init bars */
|
/* init bars */
|
||||||
updatebars();
|
updatebars();
|
||||||
updatestatus();
|
updatestatus();
|
||||||
|
updatebarpos(selmon);
|
||||||
/* supporting window for NetWMCheck */
|
/* supporting window for NetWMCheck */
|
||||||
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
|
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
|
||||||
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
|
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
|
||||||
@ -2237,7 +2244,8 @@ updatebars(void)
|
|||||||
w = m->ww;
|
w = m->ww;
|
||||||
if (showsystray && m == systraytomon(m))
|
if (showsystray && m == systraytomon(m))
|
||||||
w -= getsystraywidth();
|
w -= getsystraywidth();
|
||||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
|
// 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, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
|
||||||
CopyFromParent, DefaultVisual(dpy, screen),
|
CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||||
@ -2254,11 +2262,11 @@ updatebarpos(Monitor *m)
|
|||||||
m->wy = m->my;
|
m->wy = m->my;
|
||||||
m->wh = m->mh;
|
m->wh = m->mh;
|
||||||
if (m->showbar) {
|
if (m->showbar) {
|
||||||
m->wh -= bh;
|
m->wh = m->wh - vertpad - bh;
|
||||||
m->by = m->topbar ? m->wy : m->wy + m->wh;
|
m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
||||||
m->wy = m->topbar ? m->wy + bh : m->wy;
|
m->wy = m->topbar ? m->wy + bh + vp : m->wy;
|
||||||
} else
|
} else
|
||||||
m->by = -bh;
|
m->by = -bh - vp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2482,7 +2490,9 @@ updatesystray(void)
|
|||||||
Monitor *m = systraytomon(NULL);
|
Monitor *m = systraytomon(NULL);
|
||||||
unsigned int x = m->mx + m->mw;
|
unsigned int x = m->mx + m->mw;
|
||||||
unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
|
unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
|
||||||
unsigned int w = 1;
|
unsigned int w = 1, xpad = 0, ypad = 0;
|
||||||
|
xpad = sp;
|
||||||
|
ypad = vp;
|
||||||
|
|
||||||
if (!showsystray)
|
if (!showsystray)
|
||||||
return;
|
return;
|
||||||
@ -2492,7 +2502,7 @@ updatesystray(void)
|
|||||||
/* init systray */
|
/* init systray */
|
||||||
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
||||||
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
||||||
systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
|
systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
|
||||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
wa.event_mask = ButtonPressMask | ExposureMask;
|
||||||
wa.override_redirect = True;
|
wa.override_redirect = True;
|
||||||
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||||
@ -2527,8 +2537,11 @@ updatesystray(void)
|
|||||||
}
|
}
|
||||||
w = w ? w + systrayspacing : 1;
|
w = w ? w + systrayspacing : 1;
|
||||||
x -= w;
|
x -= w;
|
||||||
XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
|
XMoveResizeWindow(dpy, systray->win, x - xpad, m->by + ypad, w, bh);
|
||||||
wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
|
wc.x = x - xpad;
|
||||||
|
wc.y = m->by + ypad;
|
||||||
|
wc.width = w;
|
||||||
|
wc.height = bh;
|
||||||
wc.stack_mode = Above; wc.sibling = m->barwin;
|
wc.stack_mode = Above; wc.sibling = m->barwin;
|
||||||
XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
|
XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
|
||||||
XMapWindow(dpy, systray->win);
|
XMapWindow(dpy, systray->win);
|
||||||
|
Loading…
Reference in New Issue
Block a user