mirror of https://github.com/bakkeby/patches
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.7 KiB
Diff
85 lines
2.7 KiB
Diff
From a6b1b5e62da24750c057fbd8fcbea4b05bb2c152 Mon Sep 17 00:00:00 2001
|
|
From: Bakkeby <bakkeby@gmail.com>
|
|
Date: Mon, 10 Jan 2022 12:58:43 +0100
|
|
Subject: [PATCH] Monitor tags patch
|
|
|
|
This patch allows you to have different tags icons on a per-monitor
|
|
basis. This patch will conflict with a series of other patches, but
|
|
it should be more or less straightforward to sort out:
|
|
- LENGTH(tags) is replaced with TAGLENGTH
|
|
- tags[i] is replaced with tags[m->mon][i]
|
|
---
|
|
config.def.h | 6 +++++-
|
|
dwm.c | 16 ++++++++--------
|
|
2 files changed, 13 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index a2ac963..7845d7f 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -19,7 +19,11 @@ static const char *colors[][3] = {
|
|
};
|
|
|
|
/* tagging */
|
|
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
|
+#define TAGLENGTH 9
|
|
+static const char *tags[][TAGLENGTH] = {
|
|
+ { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
|
+ { "A", "B", "C", "D", "E", "F", "G", "H", "I"},
|
|
+};
|
|
|
|
static const Rule rules[] = {
|
|
/* xprop(1):
|
|
diff --git a/dwm.c b/dwm.c
|
|
index a96f33c..1ac16f4 100644
|
|
--- a/dwm.c
|
|
+++ b/dwm.c
|
|
@@ -54,7 +54,7 @@
|
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
|
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
|
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
|
-#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
|
+#define TAGMASK ((1 << TAGLENGTH) - 1)
|
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
|
|
|
/* enums */
|
|
@@ -273,7 +273,7 @@ static Window root, wmcheckwin;
|
|
#include "config.h"
|
|
|
|
/* compile-time check if all tags fit into an unsigned int bit array. */
|
|
-struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
|
+struct NumTags { char limitexceeded[TAGLENGTH > 31 ? -1 : 1]; };
|
|
|
|
/* function implementations */
|
|
void
|
|
@@ -433,9 +433,9 @@ buttonpress(XEvent *e)
|
|
if (ev->window == selmon->barwin) {
|
|
i = x = 0;
|
|
do
|
|
- x += TEXTW(tags[i]);
|
|
- while (ev->x >= x && ++i < LENGTH(tags));
|
|
- if (i < LENGTH(tags)) {
|
|
+ x += TEXTW(tags[selmon->num][i]);
|
|
+ while (ev->x >= x && ++i < TAGLENGTH);
|
|
+ if (i < TAGLENGTH) {
|
|
click = ClkTagBar;
|
|
arg.ui = 1 << i;
|
|
} else if (ev->x < x + blw)
|
|
@@ -718,10 +718,10 @@ drawbar(Monitor *m)
|
|
urg |= c->tags;
|
|
}
|
|
x = 0;
|
|
- for (i = 0; i < LENGTH(tags); i++) {
|
|
- w = TEXTW(tags[i]);
|
|
+ for (i = 0; i < TAGLENGTH; i++) {
|
|
+ w = TEXTW(tags[m->num][i]);
|
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
|
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
|
+ drw_text(drw, x, 0, w, bh, lrpad / 2, tags[m->num][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,
|
|
--
|
|
2.19.1
|
|
|