commit c4f6cb621990a73200ae554edcf92fc003f19700
parent 35fabf01a9b9b4fe380309c72154726825db774d
Author: Wim Stockman <wim@thinkerwim.org>
Date: Sat, 23 Mar 2024 16:47:55 +0100
Cycling through windows on multi monitors
Diffstat:
2 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/focusvisibletagstacks/dwm-focusvisibletagstacks-6.5.diff b/dwm.suckless.org/patches/focusvisibletagstacks/dwm-focusvisibletagstacks-6.5.diff
@@ -0,0 +1,56 @@
+diff -up dwm-a/config.def.h dwm-b/config.def.h
+--- dwm-a/config.def.h 2024-03-23 15:14:00.173450954 +0100
++++ dwm-b/config.def.h 2024-03-23 15:35:38.200217214 +0100
+@@ -65,7 +65,7 @@ static const Key keys[] = {
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
+- { MODKEY, XK_j, focusstack, {.i = +1 } },
++ { MODKEY, XK_j, focusvisibletagstacks,{.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+Only in dwm-b: config.h
+Only in dwm-b: drw.o
+Only in dwm-b: dwm
+diff -up dwm-a/dwm.c dwm-b/dwm.c
+--- dwm-a/dwm.c 2024-03-23 15:14:00.173450954 +0100
++++ dwm-b/dwm.c 2024-03-23 16:22:58.729308679 +0100
+@@ -168,6 +168,7 @@ static void expose(XEvent *e);
+ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
++static void focusvisibletagstacks(const Arg *arg);
+ static void focusstack(const Arg *arg);
+ static Atom getatomprop(Client *c, Atom prop);
+ static int getrootptr(int *x, int *y);
+@@ -835,6 +836,27 @@ focusmon(const Arg *arg)
+ focus(NULL);
+ }
+
++/* loops through all the open windows on the visible tags of all the monitors */
++/* the Arguments sets the direction for the monitors to loop through */
++void
++focusvisibletagstacks(const Arg *arg)
++{
++ Client *c = NULL;
++ Monitor *beginm = selmon;
++ if (selmon->sel) {
++ if (selmon->sel->isfullscreen && lockfullscreen) return;
++ for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
++ }
++ if (!c) {
++ do {
++ focusmon(arg);
++ }
++ while(!selmon->clients && selmon != beginm); //focus next monitor with clients
++ for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next);
++ }
++ focus(c);
++}
++
+ void
+ focusstack(const Arg *arg)
+ {
+Only in dwm-b: dwm.o
+Only in dwm-b: util.o
diff --git a/dwm.suckless.org/patches/focusvisibletagstacks/index.md b/dwm.suckless.org/patches/focusvisibletagstacks/index.md
@@ -0,0 +1,23 @@
+Focus Visible Tags Stacks
+=========================
+
+Description
+-----------
+This patch allow to cycle throught all open windows on all your monitors
+and setting the focus to it.
+Like the default focusstack but at the end of the stack it sets the focus on the next monitor that has windows.
+
+Optional you can set the direction with .i = +1 or .i =-1
+
+Default keybinding
+-------------------
+* `Mod+j`
+
+
+Download
+--------
+* [dwm-focusvisibletagstacks-6.5.diff](dwm-focusvisibletagstacks-6.5.diff)
+
+Author
+------
+* Wim Stockman - <wim [at] thinkerwim [dot] org>