Apply alttags patch and update colorscheme

This commit is contained in:
Alex Selimov 2025-05-25 22:01:18 -04:00
parent 0d3cf443d9
commit 9e64cf1ef2
3 changed files with 20 additions and 16 deletions

22
dwm.c
View file

@ -552,7 +552,7 @@ void unswallow(Client *c) {
}
void buttonpress(XEvent *e) {
unsigned int i, x, click;
unsigned int i, x, click, occ;
Arg arg = {0};
Client *c;
Monitor *m;
@ -566,9 +566,13 @@ void buttonpress(XEvent *e) {
focus(NULL);
}
if (ev->window == selmon->barwin) {
i = x = 0;
i = x = occ = 0;
/* Bitmask of occupied tags */
for (c = m->clients; c; c = c->next)
occ |= c->tags;
do
x += TEXTW(tags[i]);
x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]);
while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
@ -841,6 +845,7 @@ void drawbar(Monitor *m) {
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
const char *tagtext;
char *ts = stext;
char *tp = stext;
int tx = 0;
@ -889,18 +894,15 @@ void drawbar(Monitor *m) {
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
tagtext = occ & 1 << i ? alttags[i] : tags[i];
w = TEXTW(tagtext);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel
: SchemeTagsNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeTagsNorm]);
drw_setscheme(drw, scheme[SchemeTagsSel]);
static char text[MAX_LINE_LENGTH];
strcpy(text, exec_command_last_line(center_command));
int center_length = TEXTW(text);