| dwm-bartoggle-6.4.diff - sites - public wiki contents of suckless.org | |
| git clone git://git.suckless.org/sites | |
| Log | |
| Files | |
| Refs | |
| --- | |
| dwm-bartoggle-6.4.diff (4816B) | |
| --- | |
| 1 This patch is relatively simple. It adds 5 more options that allow you t… | |
| 2 NOTE: It does not include include keybinds, see the dwm-bartoggle-keybin… | |
| 3 | |
| 4 To use, simply patch this in and change the options this patch adds to y… | |
| 5 | |
| 6 diff -up a/config.def.h b/config.def.h | |
| 7 --- a/config.def.h 2022-10-21 15:49:56.390287336 +0200 | |
| 8 +++ b/config.def.h 2022-10-21 16:38:50.766276143 +0200 | |
| 9 @@ -4,6 +4,11 @@ | |
| 10 static const unsigned int borderpx = 1; /* border pixel of wind… | |
| 11 static const unsigned int snap = 32; /* snap pixel */ | |
| 12 static const int showbar = 1; /* 0 means no bar */ | |
| 13 +static const int showtitle = 1; /* 0 means no title */ | |
| 14 +static const int showtags = 1; /* 0 means no tags */ | |
| 15 +static const int showlayout = 1; /* 0 means no layout in… | |
| 16 +static const int showstatus = 1; /* 0 means no status ba… | |
| 17 +static const int showfloating = 1; /* 0 means no floating … | |
| 18 static const int topbar = 1; /* 0 means bottom bar */ | |
| 19 static const char *fonts[] = { "monospace:size=10" }; | |
| 20 static const char dmenufont[] = "monospace:size=10"; | |
| 21 diff -up a/dwm.c b/dwm.c | |
| 22 --- a/dwm.c 2022-10-21 15:49:56.391287336 +0200 | |
| 23 +++ b/dwm.c 2022-10-21 16:42:16.509275358 +0200 | |
| 24 @@ -435,16 +435,17 @@ buttonpress(XEvent *e) | |
| 25 if (ev->window == selmon->barwin) { | |
| 26 i = x = 0; | |
| 27 do | |
| 28 - x += TEXTW(tags[i]); | |
| 29 + if (showtags) | |
| 30 + x += TEXTW(tags[i]); | |
| 31 while (ev->x >= x && ++i < LENGTH(tags)); | |
| 32 - if (i < LENGTH(tags)) { | |
| 33 + if (i < LENGTH(tags) && showtags) { | |
| 34 click = ClkTagBar; | |
| 35 arg.ui = 1 << i; | |
| 36 - } else if (ev->x < x + TEXTW(selmon->ltsymbol)) | |
| 37 + } else if (ev->x < x + TEXTW(selmon->ltsymbol) && showl… | |
| 38 click = ClkLtSymbol; | |
| 39 - else if (ev->x > selmon->ww - (int)TEXTW(stext)) | |
| 40 + else if (ev->x > selmon->ww - (int)TEXTW(stext) && show… | |
| 41 click = ClkStatusText; | |
| 42 - else | |
| 43 + else if (showtitle) | |
| 44 click = ClkWinTitle; | |
| 45 } else if ((c = wintoclient(ev->window))) { | |
| 46 focus(c); | |
| 47 @@ -709,7 +710,7 @@ drawbar(Monitor *m) | |
| 48 return; | |
| 49 | |
| 50 /* draw status first so it can be overdrawn by tags later */ | |
| 51 - if (m == selmon) { /* status is only drawn on selected monitor … | |
| 52 + if (m == selmon && showstatus) { /* status is only drawn on sel… | |
| 53 drw_setscheme(drw, scheme[SchemeNorm]); | |
| 54 tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ | |
| 55 drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); | |
| 56 @@ -717,29 +718,35 @@ drawbar(Monitor *m) | |
| 57 | |
| 58 for (c = m->clients; c; c = c->next) { | |
| 59 occ |= c->tags; | |
| 60 - if (c->isurgent) | |
| 61 + if (c->isurgent && showtags) | |
| 62 urg |= c->tags; | |
| 63 } | |
| 64 x = 0; | |
| 65 for (i = 0; i < LENGTH(tags); i++) { | |
| 66 - w = TEXTW(tags[i]); | |
| 67 - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << … | |
| 68 - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 … | |
| 69 - if (occ & 1 << i) | |
| 70 - drw_rect(drw, x + boxs, boxs, boxw, boxw, | |
| 71 - m == selmon && selmon->sel && selmon->s… | |
| 72 - urg & 1 << i); | |
| 73 - x += w; | |
| 74 - } | |
| 75 - w = TEXTW(m->ltsymbol); | |
| 76 - drw_setscheme(drw, scheme[SchemeNorm]); | |
| 77 - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); | |
| 78 + if (showtags) { | |
| 79 + w = TEXTW(tags[i]); | |
| 80 + drw_setscheme(drw, scheme[m->tagset[m->… | |
| 81 + drw_text(drw, x, 0, w, bh, lrpad / 2, t… | |
| 82 + if (occ & 1 << i && showfloating) | |
| 83 + drw_rect(drw, x + boxs, boxs, boxw, box… | |
| 84 + m == selmon && selmon->… | |
| 85 + urg & 1 << i); | |
| 86 + x += w; | |
| 87 + } | |
| 88 + } | |
| 89 + | |
| 90 + /* draw layout indicator if showlayout */ | |
| 91 + if (showlayout) { | |
| 92 + w = TEXTW(m->ltsymbol); | |
| 93 + drw_setscheme(drw, scheme[SchemeNorm]); | |
| 94 + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, … | |
| 95 + } | |
| 96 | |
| 97 if ((w = m->ww - tw - x) > bh) { | |
| 98 - if (m->sel) { | |
| 99 + if (m->sel && showtitle) { | |
| 100 drw_setscheme(drw, scheme[m == selmon ? SchemeS… | |
| 101 drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->n… | |
| 102 - if (m->sel->isfloating) | |
| 103 + if (m->sel->isfloating && showfloating) | |
| 104 drw_rect(drw, x + boxs, boxs, boxw, box… | |
| 105 } else { | |
| 106 drw_setscheme(drw, scheme[SchemeNorm]); | |
| 107 @@ -1238,7 +1245,7 @@ propertynotify(XEvent *e) | |
| 108 } | |
| 109 if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWM… | |
| 110 updatetitle(c); | |
| 111 - if (c == c->mon->sel) | |
| 112 + if (c == c->mon->sel && showtitle) | |
| 113 drawbar(c->mon); | |
| 114 } | |
| 115 if (ev->atom == netatom[NetWMWindowType]) | |
| 116 @@ -1987,7 +1994,7 @@ updatesizehints(Client *c) | |
| 117 void | |
| 118 updatestatus(void) | |
| 119 { | |
| 120 - if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) | |
| 121 + if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)) && sho… | |
| 122 strcpy(stext, "dwm-"VERSION); | |
| 123 drawbar(selmon); | |
| 124 } |