aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorawy <awy@tutamail.com>2024-08-25 16:16:56 +0300
committerawy <awy@tutamail.com>2024-08-25 16:16:56 +0300
commita5f315ec97d940d87e2828d297edb65d801c98c5 (patch)
treea3984aa37de3d24e95855e3f917f8f25d2e5997e
parent15bd3f79fee4862a7ca46346e6dcc014ecf79712 (diff)
hide vacant tags patch
-rw-r--r--README.md1
-rw-r--r--dwl.c21
2 files changed, 14 insertions, 8 deletions
diff --git a/README.md b/README.md
index 4abe950..d6384d7 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,5 @@ v0.7
patches applied:
[bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar)
+[hide vacant tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags)
diff --git a/dwl.c b/dwl.c
index ece537a..cd8705d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -721,7 +721,7 @@ bufrelease(struct wl_listener *listener, void *data)
void
buttonpress(struct wl_listener *listener, void *data)
{
- unsigned int i = 0, x = 0;
+ unsigned int i = 0, x = 0, occ = 0;
double cx;
unsigned int click;
struct wlr_pointer_button_event *event = data;
@@ -751,9 +751,16 @@ buttonpress(struct wl_listener *listener, void *data)
(node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale;
- do
+ wl_list_for_each(c, &clients, link) {
+ if (c->mon != selmon)
+ continue;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
+ }
+ do {
+ if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i))
+ continue;
x += TEXTW(selmon, tags[i]);
- while (cx >= x && ++i < LENGTH(tags));
+ } while (cursor->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -1528,20 +1535,18 @@ drawbar(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (c->mon != m)
continue;
- occ |= c->tags;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
c = focustop(m);
for (i = 0; i < LENGTH(tags); i++) {
+ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
w = TEXTW(m, tags[i]);
drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw,
- m == selmon && c && c->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = TEXTW(m, m->ltsymbol);