--- Removes two magic numbers and replaces them with configurable variables in config.def.h A third configurable variable was added, as it made sense to be there given the existence of the other two variables. vertbarpad is vertical padding for the statusbar. horizbarpad is horizontal padding for the statusbar. statusrpad is right hand padding for StatusText in the statusbar. --- config.def.h | 3 +++ dwm.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h index a9ac303..4f03aa1 100644 --- a/config.def.h +++ b/config.def.h _AT_@ -5,6 +5,9 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const int horizbarpad = 0; /* horizontal bar padding */ +static const int vertbarpad = 2; /* vertical bar padding */ +static const int statusrpad = 2; /* right padding for StatusText */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; diff --git a/dwm.c b/dwm.c index bb95e26..9014261 100644 --- a/dwm.c +++ b/dwm.c _AT_@ -439,7 +439,7 @@ buttonpress(XEvent *e) arg.ui = 1 << i; } else if (ev->x < x + blw) click = ClkLtSymbol; - else if (ev->x > selmon->ww - TEXTW(stext)) + else if (ev->x > selmon->ww - TEXTW(stext) + lrpad - statusrpad) click = ClkStatusText; else click = ClkWinTitle; _AT_@ -704,7 +704,7 @@ drawbar(Monitor *m) /* draw status first so it can be overdrawn by tags later */ if (m == selmon) { /* status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeNorm]); - sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + sw = TEXTW(stext) - lrpad + statusrpad; drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); } _AT_@ -1544,8 +1544,8 @@ setup(void) drw = drw_create(dpy, screen, root, sw, sh); if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) die("no fonts could be loaded."); - lrpad = drw->fonts->h; - bh = drw->fonts->h + 2; + lrpad = drw->fonts->h + horizbarpad; + bh = drw->fonts->h + vertbarpad; updategeom(); /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False); -- 2.7.4Received on Fri May 25 2018 - 04:48:27 CEST
This archive was generated by hypermail 2.3.0 : Fri May 25 2018 - 05:00:28 CEST