Improved dwm patch

This commit is contained in:
Ashish Kumar Yadav 2020-07-14 03:22:25 +05:30
parent 6518005d01
commit f32d5d291c

View file

@ -1,6 +1,6 @@
diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h 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-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 @@ @@ -12,10 +12,34 @@
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee"; 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, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c 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-ori/dwm.c 2020-06-15 20:11:02.220674229 +0530
+++ dwm-6.2/dwm.c 2020-07-02 22:29:22.207225539 +0530 +++ dwm-6.2/dwm.c 2020-07-14 03:14:14.844100607 +0530
@@ -40,6 +40,8 @@ @@ -40,6 +40,8 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */ #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 boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2; int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0; 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 */ /* 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 */
@ -152,28 +152,26 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
+ +
+ drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeNorm]);
+ x = drw_text(drw, m->ww - wstext, 0, lrpad / 2, bh, 0, "", 0); /* to keep left padding clean */ + x = drw_text(drw, m->ww - wstext, 0, lrpad / 2, bh, 0, "", 0); /* to keep left padding clean */
+loopbegin: + for (;;) {
+ /* + 10 and stextc, stexts to avoid conflict b/w statusclr and statussig */
+ if ((unsigned char)*ts > LENGTH(colors) + 10 ) { + if ((unsigned char)*ts > LENGTH(colors) + 10 ) {
+ ts++; + ts++;
+ goto loopbegin; + continue;
+ } + }
+ ctmp = *ts; + ctmp = *ts;
+ *ts = '\0'; + *ts = '\0';
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0); + x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0);
+ if (ctmp == '\0') + if (ctmp == '\0')
+ goto loopend; + break;
+ /* - 11 due to + 10 above */ + /* - 11 to compensate for + 10 above */
+ drw_setscheme(drw, scheme[(unsigned char)ctmp - 11]); + drw_setscheme(drw, scheme[(unsigned char)ctmp - 11]);
+ *ts = ctmp; + *ts = ctmp;
+ tp = ++ts; + tp = ++ts;
+ goto loopbegin; + }
+loopend:
+ drw_text(drw, x, 0, m->ww - x, bh, 0, "", 0); /* to keep right padding clean */ + drw_text(drw, x, 0, m->ww - x, bh, 0, "", 0); /* to keep right padding clean */
} }
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
@@ -728,7 +766,7 @@ @@ -728,7 +764,7 @@
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); 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) { if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeSel : 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);
@@ -1122,8 +1160,11 @@ @@ -1122,8 +1158,11 @@
Monitor *m; Monitor *m;
XMotionEvent *ev = &e->xmotion; 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) { if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
unfocus(selmon->sel, 1); unfocus(selmon->sel, 1);
selmon = m; selmon = m;
@@ -1564,6 +1605,7 @@ @@ -1564,6 +1603,7 @@
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
/* init cursors */ /* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); 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[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
@@ -1637,6 +1679,28 @@ @@ -1637,6 +1677,28 @@
} }
void void
@ -232,7 +230,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (arg->v == dmenucmd) if (arg->v == dmenucmd)
@@ -1805,7 +1869,7 @@ @@ -1805,7 +1867,7 @@
XSetWindowAttributes wa = { XSetWindowAttributes wa = {
.override_redirect = True, .override_redirect = True,
.background_pixmap = ParentRelative, .background_pixmap = ParentRelative,
@ -241,7 +239,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
}; };
XClassHint ch = {"dwm", "dwm"}; XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
@@ -1821,6 +1885,33 @@ @@ -1821,6 +1883,33 @@
} }
void void
@ -275,7 +273,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
updatebarpos(Monitor *m) updatebarpos(Monitor *m)
{ {
m->wy = m->my; m->wy = m->my;
@@ -1847,6 +1938,31 @@ @@ -1847,6 +1936,31 @@
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
} }
@ -307,7 +305,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
int int
updategeom(void) updategeom(void)
{ {
@@ -1987,9 +2103,28 @@ @@ -1987,9 +2101,28 @@
void void
updatestatus(void) updatestatus(void)
{ {