mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-27 18:24:26 +00:00
bar: add hide_vacant_tags
This commit is contained in:
parent
924b14e6f6
commit
cfac8fab2a
76
bar/hide_vacant_tags.patch
Normal file
76
bar/hide_vacant_tags.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
From 7350bdb548ba4b50a666a6e7fdc71d26c6e7e191 Mon Sep 17 00:00:00 2001
|
||||||
|
From: sewn <sewn@disroot.org>
|
||||||
|
Date: Sun, 24 Mar 2024 23:07:11 +0300
|
||||||
|
Subject: [PATCH] port hide vacant tags patch
|
||||||
|
|
||||||
|
---
|
||||||
|
dwl.c | 26 +++++++++++++++++---------
|
||||||
|
1 file changed, 17 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 8341134..3332c69 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -652,7 +652,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) {
|
||||||
|
void
|
||||||
|
buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
- unsigned int i = 0, x = 0;
|
||||||
|
+ unsigned int i = 0, x = 0, occ = 0;
|
||||||
|
unsigned int click;
|
||||||
|
struct wlr_pointer_button_event *event = data;
|
||||||
|
struct wlr_keyboard *keyboard;
|
||||||
|
@@ -673,9 +673,18 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
if ((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]);
|
||||||
|
+ } while (cursor->x >= x && ++i < LENGTH(tags));
|
||||||
|
if (i < LENGTH(tags)) {
|
||||||
|
click = ClkTagBar;
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
@@ -1464,13 +1473,16 @@ drawbar(Monitor *mon)
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
if (c->mon != mon)
|
||||||
|
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))
|
||||||
|
+ continue;
|
||||||
|
w = TEXTW(tags[i]);
|
||||||
|
sel = mon->tagset[mon->seltags] & 1 << i;
|
||||||
|
|
||||||
|
@@ -1479,10 +1491,6 @@ drawbar(Monitor *mon)
|
||||||
|
draw_text(pix, x, 0, w, mon->b.height, lrpad / 2, tags[i],
|
||||||
|
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg));
|
||||||
|
|
||||||
|
- if (occ & 1 << i)
|
||||||
|
- draw_rect(pix, x + boxs, boxs, boxw, boxw,
|
||||||
|
- sel, urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg));
|
||||||
|
-
|
||||||
|
x += w;
|
||||||
|
}
|
||||||
|
w = TEXTW(mon->ltsymbol);
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user