summaryrefslogtreecommitdiffhomepage
path: root/patch/swapfocus.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-01-29 08:31:00 +0100
committerbakkeby <[email protected]>2020-01-29 11:31:52 +0100
commit5e75da8dd1be76942873d6b77f6146d415c6d64c (patch)
treedf33c2415dc0ef1e9ee136954ffac145ec66e6cc /patch/swapfocus.c
parent21ba1d7bb3a15fdef1f8425f09e400f718e73b8e (diff)
downloaddwm-flexipatch-5e75da8dd1be76942873d6b77f6146d415c6d64c.tar.gz
dwm-flexipatch-5e75da8dd1be76942873d6b77f6146d415c6d64c.zip
Adding swapfocus patch
Diffstat (limited to 'patch/swapfocus.c')
-rw-r--r--patch/swapfocus.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/patch/swapfocus.c b/patch/swapfocus.c
new file mode 100644
index 0000000..7693925
--- /dev/null
+++ b/patch/swapfocus.c
@@ -0,0 +1,21 @@
+void
+swapfocus(const Arg *arg)
+{
+ if (!selmon->sel)
+ return;
+ if (selmon->pertag->prevclient[selmon->pertag->curtag] != NULL
+ && ISVISIBLE(selmon->pertag->prevclient[selmon->pertag->curtag])) {
+ focus(selmon->pertag->prevclient[selmon->pertag->curtag]);
+ restack(selmon->pertag->prevclient[selmon->pertag->curtag]->mon);
+ }
+ else {
+ Client *c = NULL;
+ for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
+ if (!c)
+ for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next);
+ if (c) {
+ focus(c);
+ restack(selmon);
+ }
+ }
+} \ No newline at end of file