Adding hidevacanttags patch

This commit is contained in:
bakkeby 2019-10-05 23:44:18 +02:00
parent 15a4c58924
commit f096d003d9
3 changed files with 34 additions and 3 deletions

View File

@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-10-05 - Added killunsel and taggrid patches
2019-10-05 - Added killunsel, taggrid and hidevacanttags patches
2019-10-04 - Added maximize, movestack, monoclesymbol, noborder, tagall and tagintostack patches
@ -125,6 +125,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- applies the monocle layout with the focused client on top and hides the bar
- when pressed again it shows the bar and restores the layout that was active before going fullscreen
- [hidevacanttags](https://dwm.suckless.org/patches/hide_vacant_tags/)
- prevents dwm from drawing tags with no clients (i.e. vacant) on the bar
- [holdbar](http://dwm.suckless.org/patches/holdbar/)
- with this patch dwm's built-in status bar is only shown when HOLDKEY is pressed
- additionally the bar will now overlay the display

27
dwm.c
View File

@ -604,6 +604,9 @@ buttonpress(XEvent *e)
#if TAGGRID_PATCH
unsigned int columns;
#endif // TAGGRID_PATCH
#if HIDEVACANTTAGS_PATCH
unsigned int occ = 0;
#endif // HIDEVACANTTAGS_PATCH
Arg arg = {0};
Client *c;
Monitor *m;
@ -673,9 +676,18 @@ buttonpress(XEvent *e)
#if TAGGRID_PATCH
if (drawtagmask & DRAWCLASSICTAGS)
#endif // TAGGRID_PATCH
do
#if HIDEVACANTTAGS_PATCH
for (c = m->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // HIDEVACANTTAGS_PATCH
do {
#if HIDEVACANTTAGS_PATCH
/* do not reserve space for vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
#endif // HIDEVACANTTAGS_PATCH
x += TEXTW(tags[i]);
while (ev->x >= x && ++i < LENGTH(tags));
} while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)
#if TAGGRID_PATCH
&& (drawtagmask & DRAWCLASSICTAGS)
@ -1226,7 +1238,11 @@ drawbar(Monitor *m)
if (ISVISIBLE(c))
n++;
#endif // FANCYBAR_PATCH
#if HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
@ -1240,6 +1256,11 @@ drawbar(Monitor *m)
if (drawtagmask & DRAWCLASSICTAGS)
#endif // TAGGRID_PATCH
for (i = 0; i < LENGTH(tags); i++) {
#if HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
#endif // HIDEVACANTTAGS_PATCH
w = TEXTW(tags[i]);
#if ALTERNATIVE_TAGS_PATCH
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
@ -1250,6 +1271,7 @@ drawbar(Monitor *m)
#else
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
#endif // ALTERNATIVE_TAGS_PATCH
#if !HIDEVACANTTAGS_PATCH
if (occ & 1 << i)
#if ACTIVETAGINDICATORBAR_PATCH
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
@ -1260,6 +1282,7 @@ drawbar(Monitor *m)
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
#endif // ACTIVETAGINDICATORBAR_PATCH
#endif // HIDEVACANTTAGS_PATCH
x += w;
}
#if TAGGRID_PATCH

View File

@ -169,6 +169,11 @@
*/
#define FULLSCREEN_PATCH 0
/* This patch prevents dwm from drawing tags with no clients (i.e. vacant) on the bar.
* https://dwm.suckless.org/patches/hide_vacant_tags/
*/
#define HIDEVACANTTAGS_PATCH 0
/* With this patch dwm's built-in status bar is only shown when HOLDKEY is pressed
* and the bar will now overlay the display.
* http://dwm.suckless.org/patches/holdbar/