dwm-script_tags-without_fifo.diff (4143B)
1 diff -up dwmdiff/dwm-6.2/config.def.h dwm-6.2/config.def.h 2 --- dwmdiff/dwm-6.2/config.def.h 2019-02-02 13:55:28.000000000 +0100 3 +++ dwm-6.2/config.def.h 2020-05-18 20:27:30.392698992 +0200 4 @@ -3,6 +3,9 @@ 5 /* appearance */ 6 static const unsigned int borderpx = 1; /* border pixel of windows */ 7 static const unsigned int snap = 32; /* snap pixel */ 8 +static const char *tagfile = "/tmp/dwm_tags"; 9 +static const int barheight = 25; /* 0 means bottom bar */ 10 +static const char *sepchar = ":"; 11 static const int showbar = 1; /* 0 means no bar */ 12 static const int topbar = 1; /* 0 means bottom bar */ 13 static const char *fonts[] = { "monospace:size=10" }; 14 Only in dwm-6.2: config.h 15 Only in dwm-6.2: drw.o 16 Only in dwm-6.2: dwm 17 diff -up dwmdiff/dwm-6.2/dwm.c dwm-6.2/dwm.c 18 --- dwmdiff/dwm-6.2/dwm.c 2019-02-02 13:55:28.000000000 +0100 19 +++ dwm-6.2/dwm.c 2020-05-18 20:26:52.791699537 +0200 20 @@ -695,51 +695,34 @@ dirtomon(int dir) 21 void 22 drawbar(Monitor *m) 23 { 24 - int x, w, sw = 0; 25 - int boxs = drw->fonts->h / 9; 26 - int boxw = drw->fonts->h / 6 + 2; 27 unsigned int i, occ = 0, urg = 0; 28 + FILE *fd; 29 Client *c; 30 31 - /* draw status first so it can be overdrawn by tags later */ 32 - if (m == selmon) { /* status is only drawn on selected monitor */ 33 - drw_setscheme(drw, scheme[SchemeNorm]); 34 - sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 35 - drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); 36 - } 37 + fd = fopen(tagfile,"w+"); 38 39 for (c = m->clients; c; c = c->next) { 40 occ |= c->tags; 41 if (c->isurgent) 42 urg |= c->tags; 43 } 44 - x = 0; 45 for (i = 0; i < LENGTH(tags); i++) { 46 - w = TEXTW(tags[i]); 47 - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 48 - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 49 - if (occ & 1 << i) 50 - drw_rect(drw, x + boxs, boxs, boxw, boxw, 51 - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 52 - urg & 1 << i); 53 - x += w; 54 - } 55 - w = blw = TEXTW(m->ltsymbol); 56 - drw_setscheme(drw, scheme[SchemeNorm]); 57 - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); 58 - 59 - if ((w = m->ww - sw - x) > bh) { 60 - if (m->sel) { 61 - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 62 - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); 63 - if (m->sel->isfloating) 64 - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 65 - } else { 66 - drw_setscheme(drw, scheme[SchemeNorm]); 67 - drw_rect(drw, x, 0, w, bh, 1, 1); 68 - } 69 - } 70 - drw_map(drw, m->barwin, 0, 0, m->ww, bh); 71 + fprintf(fd,"%s",sepchar); 72 + if ( occ & 1 << i && m->tagset[m->seltags] & 1 << i ) { 73 + fprintf(fd,"O%s",tags[i]); 74 + } else if ( !( occ & 1 << i )&& m->tagset[m->seltags] & 1 << i ) { 75 + fprintf(fd,"E%s",tags[i]); 76 + } else if ( occ & 1 << i && !( m->tagset[m->seltags] & 1 << i ) ) { 77 + fprintf(fd,"o%s",tags[i]); 78 + } else 79 + fprintf(fd,"e%s",tags[i]); 80 + 81 + /*x += w;*/ 82 + } 83 + fprintf(fd,"%s",sepchar); 84 + fprintf(fd,"%s",m->ltsymbol); 85 + fprintf(fd,"\n"); 86 + fclose(fd); 87 } 88 89 void 90 @@ -1545,7 +1528,7 @@ setup(void) 91 if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) 92 die("no fonts could be loaded."); 93 lrpad = drw->fonts->h; 94 - bh = drw->fonts->h + 2; 95 + bh = barheight; 96 updategeom(); 97 /* init atoms */ 98 utf8string = XInternAtom(dpy, "UTF8_STRING", False); 99 @@ -1802,18 +1785,10 @@ void 100 updatebars(void) 101 { 102 Monitor *m; 103 - XSetWindowAttributes wa = { 104 - .override_redirect = True, 105 - .background_pixmap = ParentRelative, 106 - .event_mask = ButtonPressMask|ExposureMask 107 - }; 108 XClassHint ch = {"dwm", "dwm"}; 109 for (m = mons; m; m = m->next) { 110 if (m->barwin) 111 continue; 112 - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), 113 - CopyFromParent, DefaultVisual(dpy, screen), 114 - CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); 115 XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); 116 XMapRaised(dpy, m->barwin); 117 XSetClassHint(dpy, m->barwin, &ch); 118 Only in dwm-6.2: dwm.o 119 Only in dwm-6.2: dwm-script_tags-6.2.diff 120 Only in dwm-6.2: test.diff 121 Only in dwm-6.2: util.o