commit da000423d91a7bd7b8d15c775c8983966064c178
Author: Georgios Oxinos <[email protected]>
Date:   Sat Jul 24 23:51:05 2021 +0200

    [dwm][patch][canfocusfloating] canfocusfloating minor improvements

diff --git 
a/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
 
b/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210724-b914109.diff
similarity index 72%
rename from 
dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
rename to 
dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210724-b914109.diff
index 64da88f5..9900f105 100644
--- 
a/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
+++ 
b/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210724-b914109.diff
@@ -1,13 +1,13 @@
-From 2d308d6df9c139f85367fefbb905921385074d32 Mon Sep 17 00:00:00 2001
-From: Georgios Oxinos <[email protected]>
-Date: Fri, 19 Feb 2021 00:22:24 +0100
-Subject: [PATCH] [PATCH] [dwm][cantogglefloating] patch that allows disabling
- focus on floating clients
+From b9141091994ba657af534453ab913663a8258f9a Mon Sep 17 00:00:00 2001
+From: oxinosg <[email protected]>
+Date: Sat, 24 Jul 2021 23:31:30 +0200
+Subject: [PATCH] [dwm][cantogglefloating] patch that allows disabling focus on
+ floating clients
 
 ---
  config.def.h |  1 +
- dwm.c        | 57 +++++++++++++++++++++++++++++++++++++++++++++++-----
- 2 files changed, 53 insertions(+), 5 deletions(-)
+ dwm.c        | 67 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ 2 files changed, 63 insertions(+), 5 deletions(-)
 
 diff --git a/config.def.h b/config.def.h
 index 1c0b587..005fb5d 100644
@@ -22,7 +22,7 @@ index 1c0b587..005fb5d 100644
        { MODKEY,                       XK_Tab,    view,           {0} },
        { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
 diff --git a/dwm.c b/dwm.c
-index 664c527..52854a0 100644
+index 4465af1..ae0a0ea 100644
 --- a/dwm.c
 +++ b/dwm.c
 @@ -92,7 +92,7 @@ struct Client {
@@ -34,7 +34,7 @@ index 664c527..52854a0 100644
        Client *next;
        Client *snext;
        Monitor *mon;
-@@ -192,6 +192,7 @@ static Monitor *recttomon(int x, int y, int w, int h);
+@@ -191,6 +191,7 @@ static Monitor *recttomon(int x, int y, int w, int h);
  static void resize(Client *c, int x, int y, int w, int h, int interact);
  static void resizeclient(Client *c, int x, int y, int w, int h);
  static void resizemouse(const Arg *arg);
@@ -42,7 +42,7 @@ index 664c527..52854a0 100644
  static void restack(Monitor *m);
  static void run(void);
  static void scan(void);
-@@ -212,6 +213,7 @@ static void tagmon(const Arg *arg);
+@@ -211,6 +212,7 @@ static void tagmon(const Arg *arg);
  static void tile(Monitor *);
  static void togglebar(const Arg *arg);
  static void togglefloating(const Arg *arg);
@@ -50,7 +50,7 @@ index 664c527..52854a0 100644
  static void toggletag(const Arg *arg);
  static void toggleview(const Arg *arg);
  static void unfocus(Client *c, int setfocus);
-@@ -789,6 +791,8 @@ focus(Client *c)
+@@ -788,6 +790,8 @@ focus(Client *c)
        if (selmon->sel && selmon->sel != c)
                unfocus(selmon->sel, 0);
        if (c) {
@@ -59,7 +59,7 @@ index 664c527..52854a0 100644
                if (c->mon != selmon)
                        selmon = c->mon;
                if (c->isurgent)
-@@ -838,16 +842,16 @@ focusstack(const Arg *arg)
+@@ -837,16 +841,16 @@ focusstack(const Arg *arg)
        if (!selmon->sel)
                return;
        if (arg->i > 0) {
@@ -80,7 +80,7 @@ index 664c527..52854a0 100644
                                        c = i;
        }
        if (c) {
-@@ -1719,6 +1723,49 @@ togglefloating(const Arg *arg)
+@@ -1716,6 +1720,59 @@ togglefloating(const Arg *arg)
        if (selmon->sel->isfloating)
                resize(selmon->sel, selmon->sel->x, selmon->sel->y,
                        selmon->sel->w, selmon->sel->h, 0);
@@ -111,20 +111,30 @@ index 664c527..52854a0 100644
 +togglecanfocusfloating(const Arg *arg)
 +{
 +      unsigned int n;
-+      Client *c;
++      Client *c, *cf = NULL;
 +
-+      for (n = 0, c = selmon->clients; c; c = c->next, n++)
-+    if (c->isfloating)
-+      c->cantfocus = !c->cantfocus;
-+              else
-+      n++;
++  if (!selmon->sel)
++      return;
++
++  for (c = selmon->clients; c; c = c->next)
++      if (c->cantfocus == 1) {
++          cf = c;
++      }
 +
-+  if (n && selmon->sel->isfloating) {
-+              for (c = selmon->sel; c && c->isfloating; c = c->next);
-+              if (!c)
-+                      for (c = selmon->clients; c && c->isfloating; c = 
c->next);
++  if (cf) {
++      resetcanfocusfloating();
++      focus(cf);
++  } else {
++    for (n = 0, c = selmon->clients; c; c = c->next)
++        if (c->isfloating)
++            c->cantfocus = !c->cantfocus;
++        else
++            n++;
 +
-+    focus(c);
++    if (n && selmon->sel->isfloating) {
++        c = nexttiled(selmon->clients);
++        focus(c);
++    }
 +  }
 +
        arrange(selmon);
diff --git a/dwm.suckless.org/patches/canfocusfloating/index.md 
b/dwm.suckless.org/patches/canfocusfloating/index.md
index c5fc3aa5..1dfd41a9 100644
--- a/dwm.suckless.org/patches/canfocusfloating/index.md
+++ b/dwm.suckless.org/patches/canfocusfloating/index.md
@@ -3,13 +3,17 @@ canfocusfloating
 
 Description
 -----------
-Patch that allows disabling focus on floating clients.
+Patch that allows disabling/enabling focus on floating clients. (when enabled, 
if you try to focus next/previous client in current tag, all floating clients 
will be skipped)
+
+ - If floating client is selected while toggle is pressed, then master client 
is focused
+ - On re-enabling focus, first floating client is focused
+ - When user toggle floating of new client, if focus on floating clients was 
disabled, it will be removed
 
 Inspired by [canfocusrule](https://dwm.suckless.org/patches/canfocusrule/) 
patch
 
 Download
 --------
-* 
[dwm-canfocusfloating-20210219-2d308d6.diff](dwm-canfocusfloating-20210219-2d308d6.diff)
+* 
[dwm-canfocusfloating-20210724-b914109.diff](dwm-canfocusfloating-20210219-2d308d6.diff)
 
 Authors
 -------


Reply via email to