From d671b17a324784c3999332efc541913e307d05c5 Mon Sep 17 00:00:00 2001 From: _N0x Date: Sun, 19 Jun 2022 16:43:52 +0200 Subject: [PATCH] Added statuspadding patch --- dwm-6.3/config.def.h | 2 ++ dwm-6.3/dwm.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dwm-6.3/config.def.h b/dwm-6.3/config.def.h index 732e2b5..2731884 100644 --- a/dwm-6.3/config.def.h +++ b/dwm-6.3/config.def.h @@ -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 showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const int horizpadbar = 2; /* horizontal 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 dmenufont[] = "Hack Nerd Font Mono:size=11"; static const char dmenupromt[] = "Run:"; diff --git a/dwm-6.3/dwm.c b/dwm-6.3/dwm.c index f7c3bfb..b776deb 100644 --- a/dwm-6.3/dwm.c +++ b/dwm-6.3/dwm.c @@ -186,7 +186,7 @@ static void detachstack(Client *c); static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); -static int drawstatusbar(Monitor *m, int bh, char* text); +static int drawstatusbar(Monitor *m, int bh, char* text, int stw); static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); @@ -284,6 +284,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 *) = { @@ -799,7 +801,7 @@ dirtomon(int dir) } int -drawstatusbar(Monitor *m, int bh, char* stext) { +drawstatusbar(Monitor *m, int bh, char* stext, int stw) { int ret, i, w, x, len; short isCode = 0; char *text; @@ -838,7 +840,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) { w += 2; /* 1px padding on both sides */ ret = m->ww - w; - x = m->ww - w - getsystraywidth(); + x = m->ww - w;// - getsystraywidth(); drw_setscheme(drw, scheme[LENGTH(colors)]); drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; @@ -854,8 +856,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) { text[i] = '\0'; w = TEXTW(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0); - + drw_text(drw, x - stw - 2 * sp, 0, w, bh, 0, text, 0); x += w; /* process code */ @@ -898,7 +899,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) { if (!isCode) { w = TEXTW(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0); + drw_text(drw, x - stw - 2 * sp, 0, w, bh, 0, text, 0); } drw_setscheme(drw, scheme[SchemeNorm]); @@ -924,7 +925,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 */ - tw = m->ww - drawstatusbar(m, bh, stext); + tw = m->ww - drawstatusbar(m, bh, stext, stw); } resizebarwin(m); @@ -1936,8 +1937,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 + horizpadbar; + bh = drw->fonts->h + vertpadbar; updategeom(); /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False);