[wiki] [sites] [dwm] Added fadeinactive patch for dwm || BrunoCooper17

From: <git_AT_suckless.org>
Date: Tue, 08 Jun 2021 05:25:11 +0200

commit 827a6126fe89e04e40b978721b7ad4a7771b730c
Author: BrunoCooper17 <BrunoCooper17_AT_outlook.com>
Date: Mon Jun 7 22:21:08 2021 -0500

    [dwm] Added fadeinactive patch for dwm
    
    Added a site for fadeinactice patch to dwm.suckless.org.

diff --git a/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff b/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff
new file mode 100644
index 00000000..7e594f3e
--- /dev/null
+++ b/dwm.suckless.org/patches/fadeinactive/dwm-fadeinactive-20200607-67d76bd.diff
_AT_@ -0,0 +1,90 @@
+From ff573f7c27aa31d898498ae2a9bf368879ae2c3d Mon Sep 17 00:00:00 2001
+From: BrunoCooper17 <BrunoCooper17_AT_outlook.com>
+Date: Mon, 7 Jun 2021 19:12:41 -0500
+Subject: [PATCH] fadeinactive Patch
+
+---
+ config.def.h | 2 +
+ dwm.c | 18 +++++++-
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..6485e7a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -5,6 +5,8 @@ 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 const char *fonts[] = { "monospace:size=10" };
+ static const char dmenufont[] = "monospace:size=10";
+ static const char col_gray1[] = "#222222";
+diff --git a/dwm.c b/dwm.c
+index b0b3466..157659f 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -62,7 +62,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { SchemeNorm, SchemeSel }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
++ NetWMWindowTypeDialog, NetClientList, NetWMWindowsOpacity, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+_AT_@ -185,6 +185,7 @@ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
+ static Client *nexttiled(Client *c);
++static void opacity(Client *c, double opacity);
+ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+ static void quit(const Arg *arg);
+_AT_@ -798,6 +799,7 @@ focus(Client *c)
+ grabbuttons(c, 1);
+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
+ setfocus(c);
++ opacity(c, activeopacity);
+ } else {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+_AT_@ -1200,6 +1202,18 @@ nexttiled(Client *c)
+ return c;
+ }
+
++void
++opacity(Client *c, double opacity)
++{
++ if(opacity > 0 && opacity < 1) {
++ unsigned long real_opacity[] = { opacity * 0xffffffff };
++ XChangeProperty(dpy, c->win, netatom[NetWMWindowsOpacity], XA_CARDINAL,
++ 32, PropModeReplace, (unsigned char *)real_opacity,
++ 1);
++ } else
++ XDeleteProperty(dpy, c->win, netatom[NetWMWindowsOpacity]);
++}
++
+ void
+ pop(Client *c)
+ {
+_AT_@ -1563,6 +1577,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);
++ netatom[NetWMWindowsOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
+ /* init cursors */
+ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
+ cursor[CurResize] = drw_cur_create(drw, XC_sizing);
+_AT_@ -1755,6 +1770,7 @@ unfocus(Client *c, int setfocus)
+ if (!c)
+ return;
+ grabbuttons(c, 0);
++ opacity(c, inactiveopacity);
+ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
+ if (setfocus) {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+--
+2.32.0
+
diff --git a/dwm.suckless.org/patches/fadeinactive/index.md b/dwm.suckless.org/patches/fadeinactive/index.md
new file mode 100644
index 00000000..f95bfe88
--- /dev/null
+++ b/dwm.suckless.org/patches/fadeinactive/index.md
_AT_@ -0,0 +1,16 @@
+fadeinactive
+============
+
+Description
+-----------
+This patch change the opacity of all the inactive windows. This is similar to the FadeInactive hook in XMonad.
+
+This patch is based on the clientopacity patch by Fabian Blatz.
+
+Download
+--------
+* [dwm-fadeinactive-20200607-67d76bd.diff](dwm-fadeinactive-20200607-67d76bd.diff)
+
+Authors
+-------
+* Jesús Mastache Caballero <BrunoCooper17_AT_outlook.com>
\ No newline at end of file
Received on Tue Jun 08 2021 - 05:25:11 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 08 2021 - 05:36:42 CEST