summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-05 23:44:18 +0200
committerbakkeby <[email protected]>2019-10-05 23:44:18 +0200
commitf096d003d9c33ec08f1d563e8f52c44f32ed80c8 (patch)
treee626ec48349d2fbf2211bf5c74208db967a5b075
parent15a4c58924fd786b5e335f60aa8cc55f543cc772 (diff)
downloaddwm-flexipatch-f096d003d9c33ec08f1d563e8f52c44f32ed80c8.tar.gz
dwm-flexipatch-f096d003d9c33ec08f1d563e8f52c44f32ed80c8.zip
Adding hidevacanttags patch
-rw-r--r--README.md5
-rw-r--r--dwm.c27
-rw-r--r--patches.h5
3 files changed, 34 insertions, 3 deletions
diff --git a/README.md b/README.md
index a5f6af7..9a81c4d 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/dwm.c b/dwm.c
index 09b7427..d1fd225 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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
diff --git a/patches.h b/patches.h
index 8c35a63..1cb2863 100644
--- a/patches.h
+++ b/patches.h
@@ -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/