summaryrefslogtreecommitdiffhomepage
path: root/patch/bar_wintitle_floating.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-20 13:30:12 +0200
committerbakkeby <[email protected]>2020-08-20 13:30:12 +0200
commita085c788e313db693d35feefe1f6dfa1e5daf440 (patch)
tree61ec928f1c4205b31b25aa74ee8e2fb84c130977 /patch/bar_wintitle_floating.c
parentc7b84ec738e7b1c1d1110f86bff38f95cf953a49 (diff)
downloaddwm-flexipatch-a085c788e313db693d35feefe1f6dfa1e5daf440.tar.gz
dwm-flexipatch-a085c788e313db693d35feefe1f6dfa1e5daf440.zip
Adding experimental flexwintitle patch based on bartabgroups
Diffstat (limited to 'patch/bar_wintitle_floating.c')
-rw-r--r--patch/bar_wintitle_floating.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/patch/bar_wintitle_floating.c b/patch/bar_wintitle_floating.c
new file mode 100644
index 0000000..3fea3c2
--- /dev/null
+++ b/patch/bar_wintitle_floating.c
@@ -0,0 +1,44 @@
+int
+width_wintitle_floating(Bar *bar, BarWidthArg *a)
+{
+ return a->max_width;
+}
+
+int
+draw_wintitle_floating(Bar *bar, BarDrawArg *a)
+{
+ drw_rect(drw, a->x, 0, a->w, bh, 1, 1);
+ calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL);
+ return a->x + a->w;
+}
+
+int
+click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a)
+{
+ calc_wintitle_floating(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg);
+ return ClkWinTitle;
+}
+
+void
+calc_wintitle_floating(
+ Monitor *m, int offx, int tabw, int passx,
+ void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg
+) {
+ Client *c;
+ int clientsnfloating = 0, w, r;
+ int groupactive = GRP_FLOAT;
+
+ for (c = m->clients; c; c = c->next) {
+ if (!ISVISIBLE(c) || HIDDEN(c))
+ continue;
+ if (c->isfloating)
+ clientsnfloating++;
+ }
+
+ if (!clientsnfloating)
+ return;
+
+ w = tabw / clientsnfloating;
+ r = tabw % clientsnfloating;
+ c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg);
+} \ No newline at end of file