migration to openBSD
[dotfiles_afify.git] / .scripts / patches / dwmc.diff
blobd77fe22b4c2ff8e4b29cd8b225820a3b5b26897c
1 --- dwm/dwm.c 2019-10-23 22:00:05.157679567 +0300
2 +++ /mnt/data/dev/suckless/dwm-6.2/dwm.c 2019-10-23 19:34:18.724418081 +0300
3 @@ -59,7 +59,10 @@
5 /* enums */
6 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
7 -enum { SchemeNorm, SchemeSel }; /* color schemes */
8 +enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent,
9 +SchemeCol5,SchemeCol6,SchemeCol7,SchemeCol8,SchemeCol9,
10 +SchemeCol10,SchemeCol11,SchemeCol12,SchemeCol13
11 +}; /* color schemes */
12 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
13 NetWMFullscreen, NetActiveWindow, NetWMWindowType,
14 NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
15 @@ -699,13 +702,54 @@
16 int boxs = drw->fonts->h / 9;
17 int boxw = drw->fonts->h / 6 + 2;
18 unsigned int i, occ = 0, urg = 0;
19 + char *ts = stext;
20 + char *tp = stext;
21 + int tx = 0;
22 + char ctmp;
23 Client *c;
25 + /* correction for colours */
26 + int correct = 0;
27 + char *xcape = malloc (sizeof (char) * 128);
28 + memset(xcape,0,sizeof (char) * 128);
29 + for ( ; *ts != '\0' ; ts++) {
30 + if (*ts <= LENGTH(colors)) {
31 + sprintf(xcape,"%c",*ts);
32 + correct += TEXTW(xcape) - lrpad;
33 + }
34 + }
35 + free(xcape);
36 + ts = stext;
38 /* draw status first so it can be overdrawn by tags later */
39 if (m == selmon) { /* status is only drawn on selected monitor */
40 drw_setscheme(drw, scheme[SchemeNorm]);
41 - sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
42 - drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
43 + sw = TEXTW(stext) - lrpad + 2 - correct; /* 2px right padding */
44 + while (1) {
45 + if ((unsigned int)*ts > LENGTH(colors)) {ts++; continue ;}
46 + ctmp = *ts;
47 + *ts = '\0';
49 + drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
50 + tx += TEXTW(tp) - lrpad;
51 + if (ctmp == '\0') { break; }
52 + drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
53 + *ts = ctmp;
54 + tp = ++ts;
55 + }
58 for (c = m->clients; c; c = c->next) {