summaryrefslogtreecommitdiffhomepage
path: root/patch/bar.c
diff options
context:
space:
mode:
authorStein Gunnar Bakkeby <[email protected]>2022-07-05 14:55:42 +0200
committerGitHub <[email protected]>2022-07-05 14:55:42 +0200
commit5f7df0b0dc78ae00f21d5bbe892456c450506b9b (patch)
tree73610f0475c0e5b7ef5a2017e11813908e769fcd /patch/bar.c
parent20692bea017353bcaf069625bcf3bda6eed4ad51 (diff)
downloaddwm-flexipatch-5f7df0b0dc78ae00f21d5bbe892456c450506b9b.tar.gz
dwm-flexipatch-5f7df0b0dc78ae00f21d5bbe892456c450506b9b.zip
Adding tagpreview patch (#271)
Diffstat (limited to 'patch/bar.c')
-rw-r--r--patch/bar.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/patch/bar.c b/patch/bar.c
new file mode 100644
index 0000000..65e1a69
--- /dev/null
+++ b/patch/bar.c
@@ -0,0 +1,39 @@
+void
+barhover(XEvent *e, Bar *bar)
+{
+ const BarRule *br;
+ Monitor *m = bar->mon;
+ XMotionEvent *ev = &e->xmotion;
+ BarArg barg = { 0, 0, 0, 0 };
+ int r;
+
+ for (r = 0; r < LENGTH(barrules); r++) {
+ br = &barrules[r];
+ if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->hoverfunc == NULL)
+ continue;
+ if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->num)
+ continue;
+ if (bar->x[r] > ev->x || ev->x > bar->x[r] + bar->w[r])
+ continue;
+
+ barg.x = ev->x - bar->x[r];
+ barg.y = ev->y - bar->borderpx;
+ barg.w = bar->w[r];
+ barg.h = bar->bh - 2 * bar->borderpx;
+
+ br->hoverfunc(bar, &barg, ev);
+ break;
+ }
+}
+
+Bar *
+wintobar(Window win)
+{
+ Monitor *m;
+ Bar *bar;
+ for (m = mons; m; m = m->next)
+ for (bar = m->bar; bar; bar = bar->next)
+ if (bar->win == win)
+ return bar;
+ return NULL;
+}