[wiki] [sites] [dwm][cantogglefloating] focus next client fix || Georgios Oxinos

From: <git_AT_suckless.org>
Date: Fri, 19 Feb 2021 00:30:41 +0100

commit a5a3e61b1f04fa03ca46d17bd7c205bf41403433
Author: Georgios Oxinos <oxinosg_AT_gmail.com>
Date: Fri Feb 19 00:29:47 2021 +0100

    [dwm][cantogglefloating] focus next client fix

diff --git a/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210205-f42c25c.diff b/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
similarity index 72%
rename from dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210205-f42c25c.diff
rename to dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
index 7b306bd8..64da88f5 100644
--- a/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210205-f42c25c.diff
+++ b/dwm.suckless.org/patches/canfocusfloating/dwm-canfocusfloating-20210219-2d308d6.diff
_AT_@ -1,13 +1,13 @@
-From f42c25cf04c10cd042f36346423256aae4e4b80c Mon Sep 17 00:00:00 2001
+From 2d308d6df9c139f85367fefbb905921385074d32 Mon Sep 17 00:00:00 2001
 From: Georgios Oxinos <georgios.oxinos.extern_AT_elinvar.de>
-Date: Fri, 5 Feb 2021 21:06:04 +0100
-Subject: [PATCH] [dwm][cantogglefloating] patch that allows disabling focus on
- floating clients
+Date: Fri, 19 Feb 2021 00:22:24 +0100
+Subject: [PATCH] [PATCH] [dwm][cantogglefloating] patch that allows disabling
+ focus on floating clients
 
 ---
  config.def.h | 1 +
- dwm.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++----
- 2 files changed, 63 insertions(+), 5 deletions(-)
+ dwm.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ 2 files changed, 53 insertions(+), 5 deletions(-)
 
 diff --git a/config.def.h b/config.def.h
 index 1c0b587..005fb5d 100644
_AT_@ -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..a80f7b6 100644
+index 664c527..52854a0 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -92,7 +92,7 @@ struct Client {
_AT_@ -34,15 +34,7 @@ index 664c527..a80f7b6 100644
          Client *next;
          Client *snext;
          Monitor *mon;
-_AT_@ -138,6 +138,7 @@ typedef struct {
- const char *title;
- unsigned int tags;
- int isfloating;
-+ int cantfocus;
- int monitor;
- } Rule;
-
-_AT_@ -192,6 +193,7 @@ static Monitor *recttomon(int x, int y, int w, int h);
+_AT_@ -192,6 +192,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);
_AT_@ -50,7 +42,7 @@ index 664c527..a80f7b6 100644
  static void restack(Monitor *m);
  static void run(void);
  static void scan(void);
-_AT_@ -212,6 +214,7 @@ static void tagmon(const Arg *arg);
+_AT_@ -212,6 +213,7 @@ static void tagmon(const Arg *arg);
  static void tile(Monitor *);
  static void togglebar(const Arg *arg);
  static void togglefloating(const Arg *arg);
_AT_@ -58,7 +50,7 @@ index 664c527..a80f7b6 100644
  static void toggletag(const Arg *arg);
  static void toggleview(const Arg *arg);
  static void unfocus(Client *c, int setfocus);
-_AT_@ -789,6 +792,8 @@ focus(Client *c)
+_AT_@ -789,6 +791,8 @@ focus(Client *c)
          if (selmon->sel && selmon->sel != c)
                  unfocus(selmon->sel, 0);
          if (c) {
_AT_@ -67,7 +59,7 @@ index 664c527..a80f7b6 100644
                  if (c->mon != selmon)
                          selmon = c->mon;
                  if (c->isurgent)
-_AT_@ -838,16 +843,16 @@ focusstack(const Arg *arg)
+_AT_@ -838,16 +842,16 @@ focusstack(const Arg *arg)
          if (!selmon->sel)
                  return;
          if (arg->i > 0) {
_AT_@ -88,7 +80,7 @@ index 664c527..a80f7b6 100644
                                          c = i;
          }
          if (c) {
-_AT_@ -1719,6 +1724,58 @@ togglefloating(const Arg *arg)
+_AT_@ -1719,6 +1723,49 @@ togglefloating(const Arg *arg)
          if (selmon->sel->isfloating)
                  resize(selmon->sel, selmon->sel->x, selmon->sel->y,
                          selmon->sel->w, selmon->sel->h, 0);
_AT_@ -118,30 +110,21 @@ index 664c527..a80f7b6 100644
 +void
 +togglecanfocusfloating(const Arg *arg)
 +{
-+ unsigned int i, n, y;
-+ Client *c, *tmp;
-+
-+ for (n = 0, c = selmon->clients; c; c = c->next)
-+ if (c && !c->isfloating)
-+ n++;
-+ if (n == 0) {
-+ resetcanfocusfloating();
-+ return;
-+ }
++ unsigned int n;
++ Client *c;
 +
-+ for (i = 0, y = 0, c = selmon->clients; c; c = c->next, i++)
-+ if (c->isfloating) {
++ for (n = 0, c = selmon->clients; c; c = c->next, n++)
++ if (c->isfloating)
 + c->cantfocus = !c->cantfocus;
-+ y++;
-+ }
++ else
++ n++;
 +
-+ if (y && selmon->sel->isfloating) {
-+ tmp = selmon->clients;
-+ while (!tmp || tmp->isfloating) {
-+ tmp = tmp->next;
-+ }
++ 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);
 +
-+ focus(tmp);
++ focus(c);
 + }
 +
          arrange(selmon);
diff --git a/dwm.suckless.org/patches/canfocusfloating/index.md b/dwm.suckless.org/patches/canfocusfloating/index.md
index 1a08b301..c5fc3aa5 100644
--- a/dwm.suckless.org/patches/canfocusfloating/index.md
+++ b/dwm.suckless.org/patches/canfocusfloating/index.md
_AT__AT_ -9,7 +9,7 @@ Inspired by [canfocusrule](https://dwm.suckless.org/patches/canfocusrule/) patch
 
 Download
 --------
-* [dwm-canfocusfloating-20210205-f42c25c.diff](dwm-canfocusfloating-20210205-f42c25c.diff)
+* [dwm-canfocusfloating-20210219-2d308d6.diff](dwm-canfocusfloating-20210219-2d308d6.diff)
 
 Authors
 -------
Received on Fri Feb 19 2021 - 00:30:41 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 19 2021 - 00:36:52 CET