summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-22 20:30:51 +0200
committerbakkeby <[email protected]>2020-08-22 20:30:51 +0200
commit46ebaea58f121a33ed0d3ea07f40cfb70c9de2f9 (patch)
treedbbed25100f3c3a9ccfba12b0323206b2abcfdf8 /patch
parent32819a48f3efb57c010d3d27c6b2a537916793b2 (diff)
downloaddwm-flexipatch-46ebaea58f121a33ed0d3ea07f40cfb70c9de2f9.tar.gz
dwm-flexipatch-46ebaea58f121a33ed0d3ea07f40cfb70c9de2f9.zip
Added clientindicators patch and unified and simplified indicator code. Enabled centeredwindowname option for awesomebar and bartabgroups patches.
Diffstat (limited to 'patch')
-rw-r--r--patch/bar_indicators.c66
-rw-r--r--patch/bar_indicators.h10
2 files changed, 76 insertions, 0 deletions
diff --git a/patch/bar_indicators.c b/patch/bar_indicators.c
new file mode 100644
index 0000000..863923e
--- /dev/null
+++ b/patch/bar_indicators.c
@@ -0,0 +1,66 @@
+/* Indicator properties, you can override these in your config.h if you want. */
+#ifndef TAGSINDICATOR
+#define TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on
+#endif
+#ifndef TAGSPX
+#define TAGSPX 5 // # pixels for tag grid boxes
+#endif
+#ifndef TAGSROWS
+#define TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3)
+#endif
+
+void
+drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type)
+{
+ int i, boxw, boxs, indn = 0;
+ if (!(occ & 1 << tag))
+ return;
+
+ boxs = drw->fonts->h / 9;
+ boxw = drw->fonts->h / 6 + 2;
+ if (filled == -1)
+ filled = m == selmon && m->sel && m->sel->tags & 1 << tag;
+
+ switch (type) {
+ default:
+ case INDICATOR_TOP_LEFT_SQUARE:
+ drw_rect(drw, x + boxs, boxs, boxw, boxw, filled, invert);
+ break;
+ case INDICATOR_TOP_LEFT_LARGER_SQUARE:
+ drw_rect(drw, x + boxs + 2, boxs+1, boxw+1, boxw+1, filled, invert);
+ break;
+ case INDICATOR_TOP_BAR:
+ drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw/2, filled, invert);
+ break;
+ case INDICATOR_BOTTOM_BAR:
+ drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 1, invert);
+ break;
+ case INDICATOR_CLIENT_DOTS:
+ for (c = m->clients; c; c = c->next) {
+ if (c->tags & (1 << tag)) {
+ drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert);
+ indn++;
+ }
+ if (bh <= 1 + (indn * 2)) {
+ indn = 0;
+ x += 2;
+ }
+ }
+ break;
+ case INDICATOR_RIGHT_TAGS:
+ if (!c)
+ break;
+ for (i = 0; i < LENGTH(tags); i++) {
+ drw_rect(drw,
+ ( x + w - 2 - ((LENGTH(tags) / TAGSROWS) * TAGSPX)
+ - (i % (LENGTH(tags)/TAGSROWS)) + ((i % (LENGTH(tags) / TAGSROWS)) * TAGSPX)
+ ),
+ ( 2 + ((i / (LENGTH(tags)/TAGSROWS)) * TAGSPX)
+ - ((i / (LENGTH(tags)/TAGSROWS)))
+ ),
+ TAGSPX, TAGSPX, (c->tags >> i) & 1, 0
+ );
+ }
+ break;
+ }
+} \ No newline at end of file
diff --git a/patch/bar_indicators.h b/patch/bar_indicators.h
new file mode 100644
index 0000000..cd1d259
--- /dev/null
+++ b/patch/bar_indicators.h
@@ -0,0 +1,10 @@
+enum {
+ INDICATOR_TOP_LEFT_SQUARE,
+ INDICATOR_TOP_LEFT_LARGER_SQUARE,
+ INDICATOR_TOP_BAR,
+ INDICATOR_BOTTOM_BAR,
+ INDICATOR_CLIENT_DOTS,
+ INDICATOR_RIGHT_TAGS
+};
+
+static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type); \ No newline at end of file