Added statuspadding patch

This commit is contained in:
_N0x 2022-06-19 16:43:52 +02:00
parent b77fa68087
commit d671b17a32
2 changed files with 12 additions and 9 deletions

View File

@ -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 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 *fonts[] = { "Hack Nerd Font Mono:size=11" };
static const char dmenufont[] = "Hack Nerd Font Mono:size=11"; static const char dmenufont[] = "Hack Nerd Font Mono:size=11";
static const char dmenupromt[] = "Run:"; static const char dmenupromt[] = "Run:";

View File

@ -186,7 +186,7 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir); static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m); static void drawbar(Monitor *m);
static void drawbars(void); 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 enternotify(XEvent *e);
static void expose(XEvent *e); static void expose(XEvent *e);
static void focus(Client *c); static void focus(Client *c);
@ -284,6 +284,8 @@ static int screen;
static int sw, sh; /* X display screen geometry width, height */ static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */ static int bh, blw = 0; /* bar geometry */
static int lrpad; /* sum of left and right padding for text */ 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 int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0; static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = { static void (*handler[LASTEvent]) (XEvent *) = {
@ -799,7 +801,7 @@ dirtomon(int dir)
} }
int int
drawstatusbar(Monitor *m, int bh, char* stext) { drawstatusbar(Monitor *m, int bh, char* stext, int stw) {
int ret, i, w, x, len; int ret, i, w, x, len;
short isCode = 0; short isCode = 0;
char *text; char *text;
@ -838,7 +840,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
w += 2; /* 1px padding on both sides */ w += 2; /* 1px padding on both sides */
ret = m->ww - w; ret = m->ww - w;
x = m->ww - w - getsystraywidth(); x = m->ww - w;// - getsystraywidth();
drw_setscheme(drw, scheme[LENGTH(colors)]); drw_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
@ -854,8 +856,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
text[i] = '\0'; text[i] = '\0';
w = TEXTW(text) - lrpad; 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; x += w;
/* process code */ /* process code */
@ -898,7 +899,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
if (!isCode) { if (!isCode) {
w = TEXTW(text) - lrpad; 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]); drw_setscheme(drw, scheme[SchemeNorm]);
@ -924,7 +925,7 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */ /* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */ 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); resizebarwin(m);
@ -1936,8 +1937,8 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh); drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded."); die("no fonts could be loaded.");
lrpad = drw->fonts->h; lrpad = drw->fonts->h + horizpadbar;
bh = drw->fonts->h + 2; bh = drw->fonts->h + vertpadbar;
updategeom(); updategeom();
/* init atoms */ /* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False); utf8string = XInternAtom(dpy, "UTF8_STRING", False);