hide_vacant_tags: bar 2024-06-10

This commit is contained in:
sewn 2024-06-10 16:37:52 +03:00
parent 2c021f570f
commit fc9f470ef3
No known key found for this signature in database
2 changed files with 21 additions and 23 deletions

View File

@ -4,7 +4,7 @@ Prevent [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) from drawing tags w
It also stops drawing empty rectangles on the bar for non-vacant tags as there is no need anymore to distinguish vacant tags and it offers a more visible contrast than if there were filled/empty rectangles.
### Download
- [2024-04-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-04-14)
- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-06-10)
### Authors
- [sewn](https://codeberg.org/sewn)

View File

@ -1,17 +1,18 @@
From 6337cf36554eda98f3d160ef4fdd12eb042f4120 Mon Sep 17 00:00:00 2001
From be3ef9ff5373e004cd8ed564a9671cd190e1db40 Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org>
Date: Sun, 14 Apr 2024 07:58:53 +0300
Subject: [PATCH] port hide vacant tags patch
Date: Mon, 10 Jun 2024 14:50:07 +0300
Subject: [PATCH] hide vacant tags
https://dwm.suckless.org/patches/hide_vacant_tags/
---
dwl.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
dwl.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/dwl.c b/dwl.c
index 54273ae..7db6273 100644
index cd484bd..de474a6 100644
--- a/dwl.c
+++ b/dwl.c
@@ -651,7 +651,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) {
@@ -654,7 +654,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) {
void
buttonpress(struct wl_listener *listener, void *data)
{
@ -20,46 +21,43 @@ index 54273ae..7db6273 100644
unsigned int click;
struct wlr_pointer_button_event *event = data;
struct wlr_keyboard *keyboard;
@@ -672,9 +672,17 @@ buttonpress(struct wl_listener *listener, void *data)
if ((node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
@@ -675,9 +675,16 @@ buttonpress(struct wl_listener *listener, void *data)
if (!c && (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) {
x = selmon->m.x;
- do
- x += TEXTW(tags[i]);
- while (cursor->x >= x && ++i < LENGTH(tags));
+ wl_list_for_each(c, &clients, link) {
+ if (c->mon != selmon)
+ continue;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
+ }
+ do {
+ /* Do not reserve space for vacant tags */
+ if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i))
+ continue;
+ x += TEXTW(tags[i]);
x += TEXTW(selmon, tags[i]);
- while (cursor->x >= x && ++i < LENGTH(tags));
+ } while (cursor->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -1379,13 +1387,16 @@ drawbar(Monitor *mon)
@@ -1384,23 +1391,21 @@ drawbar(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (c->mon != mon)
if (c->mon != m)
continue;
- occ |= c->tags;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
c = focustop(mon);
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* Do not draw vacant tags */
+ if(!(occ & 1 << i || mon->tagset[mon->seltags] & 1 << i))
- w = TEXTW(m, tags[i]);
sel = m->tagset[m->seltags] & 1 << i;
+ if(!(occ & 1 << i || sel))
+ continue;
w = TEXTW(tags[i]);
sel = mon->tagset[mon->seltags] & 1 << i;
+ w = TEXTW(m, tags[i]);
@@ -1393,10 +1404,6 @@ drawbar(Monitor *mon)
drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i],
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
@ -71,5 +69,5 @@ index 54273ae..7db6273 100644
}
--
2.44.0
2.45.0