commit 0db278a6b889dc4a8c4f9c5c151dfe695d9b4e4c
Author: BrunoCooper17 <[email protected]>
Date:   Sun Nov 14 23:18:32 2021 -0600

    [dwm][patches][fadeinactive] Added toggle funtion for patch

diff --git 
a/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff 
b/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20211114-a786211.diff
similarity index 61%
rename from 
dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff
rename to 
dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20211114-a786211.diff
index 7e594f3e..2e788af0 100644
--- 
a/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff
+++ 
b/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20211114-a786211.diff
@@ -1,28 +1,37 @@
-From ff573f7c27aa31d898498ae2a9bf368879ae2c3d Mon Sep 17 00:00:00 2001
+From dcdb97829cc2bb4e842ca66142eb24b4b4028a9f Mon Sep 17 00:00:00 2001
 From: BrunoCooper17 <[email protected]>
-Date: Mon, 7 Jun 2021 19:12:41 -0500
+Date: Sun, 14 Nov 2021 23:10:08 -0600
 Subject: [PATCH] fadeinactive Patch
 
 ---
- config.def.h                   |  2 +
- dwm.c                          | 18 +++++++-
- 2 files changed, 19 insertions(+), 1 deletion(-)
+ config.def.h |  4 ++++
+ dwm.c        | 27 ++++++++++++++++++++++++++-
+ 2 files changed, 30 insertions(+), 1 deletion(-)
 
 diff --git a/config.def.h b/config.def.h
-index 1c0b587..6485e7a 100644
+index a2ac963..2e001cf 100644
 --- a/config.def.h
 +++ b/config.def.h
-@@ -5,6 +5,8 @@ static const unsigned int borderpx  = 1;        /* border 
pixel of windows */
+@@ -5,6 +5,9 @@ static const unsigned int borderpx  = 1;        /* border 
pixel of windows */
  static const unsigned int snap      = 32;       /* snap pixel */
  static const int showbar            = 1;        /* 0 means no bar */
  static const int topbar             = 1;        /* 0 means bottom bar */
 +static const double activeopacity   = 1.0f;     /* Window opacity when it's 
focused (0 <= opacity <= 1) */
 +static const double inactiveopacity = 0.875f;   /* Window opacity when it's 
inactive (0 <= opacity <= 1) */
++static       Bool bUseOpacity       = True;     /* Starts with opacity on any 
unfocused windows */
  static const char *fonts[]          = { "monospace:size=10" };
  static const char dmenufont[]       = "monospace:size=10";
  static const char col_gray1[]       = "#222222";
+@@ -73,6 +76,7 @@ static Key keys[] = {
+       { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} 
},
+       { MODKEY,                       XK_Return, zoom,           {0} },
+       { MODKEY,                       XK_Tab,    view,           {0} },
++      { MODKEY,                       XK_a,      toggleopacity,  {0} },
+       { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
+       { MODKEY,                       XK_t,      setlayout,      {.v = 
&layouts[0]} },
+       { MODKEY,                       XK_f,      setlayout,      {.v = 
&layouts[1]} },
 diff --git a/dwm.c b/dwm.c
-index b0b3466..157659f 100644
+index 5e4d494..d506b1a 100644
 --- a/dwm.c
 +++ b/dwm.c
 @@ -62,7 +62,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@@ -42,7 +51,15 @@ index b0b3466..157659f 100644
  static void pop(Client *);
  static void propertynotify(XEvent *e);
  static void quit(const Arg *arg);
-@@ -798,6 +799,7 @@ focus(Client *c)
+@@ -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);
++static void toggleopacity(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+@@ -798,6 +800,7 @@ focus(Client *c)
                grabbuttons(c, 1);
                XSetWindowBorder(dpy, c->win, 
scheme[SchemeSel][ColBorder].pixel);
                setfocus(c);
@@ -50,14 +67,14 @@ index b0b3466..157659f 100644
        } else {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
                XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
-@@ -1200,6 +1202,18 @@ nexttiled(Client *c)
+@@ -1200,6 +1203,18 @@ nexttiled(Client *c)
        return c;
  }
  
 +void
 +opacity(Client *c, double opacity)
 +{
-+      if(opacity > 0 && opacity < 1) {
++      if(bUseOpacity && opacity > 0 && opacity < 1) {
 +              unsigned long real_opacity[] = { opacity * 0xffffffff };
 +              XChangeProperty(dpy, c->win, netatom[NetWMWindowsOpacity], 
XA_CARDINAL,
 +                              32, PropModeReplace, (unsigned char 
*)real_opacity,
@@ -69,7 +86,7 @@ index b0b3466..157659f 100644
  void
  pop(Client *c)
  {
-@@ -1563,6 +1577,7 @@ setup(void)
+@@ -1563,6 +1578,7 @@ setup(void)
        netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", 
False);
        netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, 
"_NET_WM_WINDOW_TYPE_DIALOG", False);
        netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
@@ -77,7 +94,22 @@ index b0b3466..157659f 100644
        /* init cursors */
        cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
        cursor[CurResize] = drw_cur_create(drw, XC_sizing);
-@@ -1755,6 +1770,7 @@ unfocus(Client *c, int setfocus)
+@@ -1722,6 +1738,14 @@ togglefloating(const Arg *arg)
+       arrange(selmon);
+ }
+ 
++void
++toggleopacity(const Arg *arg) {
++      bUseOpacity = !bUseOpacity;
++      for (Monitor* m = mons; m; m = m->next)
++              for (Client* c = m->clients; c; c = c->next)
++                      opacity(c, (bUseOpacity && c != selmon->sel) ? 
inactiveopacity : activeopacity);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+@@ -1755,6 +1779,7 @@ unfocus(Client *c, int setfocus)
        if (!c)
                return;
        grabbuttons(c, 0);
@@ -86,5 +118,5 @@ index b0b3466..157659f 100644
        if (setfocus) {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
 -- 
-2.32.0
+2.33.1
 
diff --git a/dwm.suckless.org/patches/fadeinactive/index.md 
b/dwm.suckless.org/patches/fadeinactive/index.md
index f95bfe88..e5701b9b 100644
--- a/dwm.suckless.org/patches/fadeinactive/index.md
+++ b/dwm.suckless.org/patches/fadeinactive/index.md
@@ -9,8 +9,8 @@ This patch is based on the clientopacity patch by Fabian Blatz.
 
 Download
 --------
-* 
[dwm-fadeinactive-20200607-67d76bd.diff](dwm-fadeinactive-20200607-67d76bd.diff)
+* 
[dwm-fadeinactive-20211114-a786211.diff](dwm-fadeinactive-20211114-a786211.diff)
 
 Authors
 -------
-* Jesús Mastache Caballero <[email protected]>
\ No newline at end of file
+* Jesús Mastache Caballero <[email protected]>


Reply via email to