From 5cc0f6e86a7c379eb182ed1fc4c2ca4f5fe9583f Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Mon, 20 Mar 2023 12:39:49 +0100 Subject: [PATCH] Add different tags icons for Monitor 0 --- config.h | 20 ++++++++++---------- dwm.c | 14 ++++++-------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/config.h b/config.h index 47182c3..79da07a 100644 --- a/config.h +++ b/config.h @@ -51,24 +51,24 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating isfakefullscreen isterminal noswallow ignoretransient monitor */ - {"jetbrains-studio", NULL, NULL, 0, 1, 0, 0, 0, 0, -1}, {"st", NULL, NULL, 0, 0, 0, 1, 1, 0, -1}, {"Xephyr", NULL, NULL, 0, 1, 0, 0, 0, 0, -1}, {"Xnest", NULL, NULL, 0, 1, 0, 0, 0, 0, -1}, {"streamdeck", NULL, NULL, 0, 0, 0, 0, 1, 0, -1}, {"firefox", NULL, "Picture-in-Picture", DWM_ALL_TAGS,1, 0, 0, 0, 0, -1}, /* Tag 1  */ - {"firefox", NULL, "YouTube", 1 << 0, 0, 0, 0, 0, 0, 1}, - {"firefox", NULL, "Twitch", 1 << 0, 0, 0, 0, 0, 0, 1}, + {"firefox", NULL, "YouTube", 1 << 0, 0, 1, 0, 0, 0, 1}, + {"firefox", NULL, "Twitch", 1 << 0, 0, 1, 0, 0, 0, 1}, {"firefox", NULL, NULL, 1 << 0, 0, 1, 0, 0, 0, -1}, /* Tag 2  */ - {"jetbrains-toolbox", NULL, NULL, 1 << 1, 1, 0, 0, 1, 0, -1}, - {"jetbrains-idea", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, -1}, - {"jetbrains-studio", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, -1}, - {"jetbrains-webstorm", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, -1}, - {"jetbrains-clion", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, -1}, - {"jetbrains-pycharm", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, -1}, - {"jetbrains-idea", NULL, "Welcome to IntelliJ IDEA", 1 << 1, 1, 0, 0, 1, 0, -1}, + {"jetbrains-studio", NULL, NULL, 1 << 1, 1, 0, 0, 0, 0, 0}, + {"jetbrains-toolbox", NULL, NULL, 1 << 1, 1, 0, 0, 1, 0, 0}, + {"jetbrains-idea", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, 0}, + {"jetbrains-studio", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, 0}, + {"jetbrains-webstorm", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, 0}, + {"jetbrains-clion", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, 0}, + {"jetbrains-pycharm", NULL, NULL, 1 << 1, 0, 0, 0, 1, 1, 0}, + {"jetbrains-idea", NULL, "Welcome to IntelliJ IDEA", 1 << 1, 1, 0, 0, 1, 0, 0}, /* Tag 3  */ { "Cider", NULL, NULL, 1 << 2, 0, 0, 0, 0, 0, -1}, /* Tag 4  */ diff --git a/dwm.c b/dwm.c index 1604ac4..4c05686 100644 --- a/dwm.c +++ b/dwm.c @@ -554,9 +554,10 @@ buttonpress(XEvent *e) focus(NULL); } if (ev->window == selmon->barwin) { - i = x = 0; + const char **tags_ = m->num==0 ? tags0 : tags; + i = x = 0; do - x += TEXTW(tags[i]); + x += TEXTW(tags_[i]); while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; @@ -928,14 +929,11 @@ drawbar(Monitor *m) urg |= c->tags; } x = 0; + const char **tags_ = m->num==0 ? tags0 : tags; for (i = 0; i < LENGTH(tags); i++) { - w = TEXTW(tags[i]); + w = TEXTW(tags_[i]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); - if(m->num == 0){ - drw_text(drw, x, 0, w, bh, lrpad / 2, tags0[i], urg & 1 << i); - } else { - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); - } + 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,