From f32d5d291ca4e79353b224052db1df2c1e682aa4 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Yadav Date: Tue, 14 Jul 2020 03:22:25 +0530 Subject: [PATCH] Improved dwm patch --- patches/dwm-dwmblocks-6.2.diff | 54 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/patches/dwm-dwmblocks-6.2.diff b/patches/dwm-dwmblocks-6.2.diff index c77c7c7..11f461d 100644 --- a/patches/dwm-dwmblocks-6.2.diff +++ b/patches/dwm-dwmblocks-6.2.diff @@ -1,6 +1,6 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h --- dwm-6.2-ori/config.def.h 2019-02-02 18:25:28.000000000 +0530 -+++ dwm-6.2/config.def.h 2020-07-02 22:13:34.676860032 +0530 ++++ dwm-6.2/config.def.h 2020-07-14 03:02:46.964798804 +0530 @@ -12,10 +12,34 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; @@ -50,8 +50,8 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c ---- dwm-6.2-ori/dwm.c 2019-02-02 18:25:28.000000000 +0530 -+++ dwm-6.2/dwm.c 2020-07-02 22:29:22.207225539 +0530 +--- dwm-6.2-ori/dwm.c 2020-06-15 20:11:02.220674229 +0530 ++++ dwm-6.2/dwm.c 2020-07-14 03:14:14.844100607 +0530 @@ -40,6 +40,8 @@ #include #endif /* XINERAMA */ @@ -139,7 +139,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; -@@ -703,9 +720,30 @@ +@@ -703,9 +720,28 @@ /* draw status first so it can be overdrawn by tags later */ if (m == selmon) { /* status is only drawn on selected monitor */ @@ -152,28 +152,26 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c + + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, m->ww - wstext, 0, lrpad / 2, bh, 0, "", 0); /* to keep left padding clean */ -+loopbegin: -+ /* + 10 and stextc, stexts to avoid conflict b/w statusclr and statussig */ -+ if ((unsigned char)*ts > LENGTH(colors) + 10 ) { -+ ts++; -+ goto loopbegin; ++ for (;;) { ++ if ((unsigned char)*ts > LENGTH(colors) + 10 ) { ++ ts++; ++ continue; ++ } ++ ctmp = *ts; ++ *ts = '\0'; ++ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0); ++ if (ctmp == '\0') ++ break; ++ /* - 11 to compensate for + 10 above */ ++ drw_setscheme(drw, scheme[(unsigned char)ctmp - 11]); ++ *ts = ctmp; ++ tp = ++ts; + } -+ ctmp = *ts; -+ *ts = '\0'; -+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0); -+ if (ctmp == '\0') -+ goto loopend; -+ /* - 11 due to + 10 above */ -+ drw_setscheme(drw, scheme[(unsigned char)ctmp - 11]); -+ *ts = ctmp; -+ tp = ++ts; -+ goto loopbegin; -+loopend: + drw_text(drw, x, 0, m->ww - x, bh, 0, "", 0); /* to keep right padding clean */ } for (c = m->clients; c; c = c->next) { -@@ -728,7 +766,7 @@ +@@ -728,7 +764,7 @@ drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -182,7 +180,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); -@@ -1122,8 +1160,11 @@ +@@ -1122,8 +1158,11 @@ Monitor *m; XMotionEvent *ev = &e->xmotion; @@ -195,7 +193,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { unfocus(selmon->sel, 1); selmon = m; -@@ -1564,6 +1605,7 @@ +@@ -1564,6 +1603,7 @@ netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); @@ -203,7 +201,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurMove] = drw_cur_create(drw, XC_fleur); /* init appearance */ -@@ -1637,6 +1679,28 @@ +@@ -1637,6 +1677,28 @@ } void @@ -232,7 +230,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c spawn(const Arg *arg) { if (arg->v == dmenucmd) -@@ -1805,7 +1869,7 @@ +@@ -1805,7 +1867,7 @@ XSetWindowAttributes wa = { .override_redirect = True, .background_pixmap = ParentRelative, @@ -241,7 +239,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c }; XClassHint ch = {"dwm", "dwm"}; for (m = mons; m; m = m->next) { -@@ -1821,6 +1885,33 @@ +@@ -1821,6 +1883,33 @@ } void @@ -275,7 +273,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c updatebarpos(Monitor *m) { m->wy = m->my; -@@ -1847,6 +1938,31 @@ +@@ -1847,6 +1936,31 @@ (unsigned char *) &(c->win), 1); } @@ -307,7 +305,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c int updategeom(void) { -@@ -1987,9 +2103,28 @@ +@@ -1987,9 +2101,28 @@ void updatestatus(void) {