[wiki] [sites] [dwm][patch][sticky] patch update || elbachir-one

From: <git_AT_suckless.org>
Date: Fri, 27 Sep 2024 14:08:35 +0200

commit d7d90d803adca680b5f722089b18e11ae02146f4
Author: elbachir-one <bachiralfa_AT_gmail.com>
Date: Fri Sep 27 13:01:42 2024 +0100

    [dwm][patch][sticky] patch update
    
        * Added the missing keybinding.

diff --git a/dwm.suckless.org/patches/sticky/dwm-sticky-20240927-60f7034.diff b/dwm.suckless.org/patches/sticky/dwm-sticky-20240927-60f7034.diff
new file mode 100644
index 00000000..055d0193
--- /dev/null
+++ b/dwm.suckless.org/patches/sticky/dwm-sticky-20240927-60f7034.diff
_AT_@ -0,0 +1,146 @@
+From 60f7034ca1573e10cf9e005e2ef5a44e6b76ea9b Mon Sep 17 00:00:00 2001
+From: elbachir-one <bachiralfa_AT_gmail.com>
+Date: Fri, 27 Sep 2024 12:35:36 +0100
+Subject: [PATCH] Added the missing keybinding
+
+---
+ config.def.h | 1 +
+ dwm.c | 43 ++++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 41 insertions(+), 3 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..55c0a6c 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -95,6 +95,7 @@ static const Key keys[] = {
+ TAGKEYS( XK_8, 7)
+ TAGKEYS( XK_9, 8)
+ { MODKEY|ShiftMask, XK_q, quit, {0} },
++ { MODKEY, XK_s, togglesticky, {0} },
+ };
+
+ /* button definitions */
+diff --git a/dwm.c b/dwm.c
+index 67c6b2b..e8ed755 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -49,7 +49,7 @@
+ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
+ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
+ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
+-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
++#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky)
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+_AT_@ -61,7 +61,7 @@
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { SchemeNorm, SchemeSel }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
++ NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+_AT_@ -92,7 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
+ int bw, oldbw;
+ unsigned int tags;
+- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+_AT_@ -200,6 +200,7 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setsticky(Client *c, int sticky);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+_AT_@ -211,6 +212,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglesticky(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+_AT_@ -525,6 +527,10 @@ clientmessage(XEvent *e)
+ || cme->data.l[2] == netatom[NetWMFullscreen])
+ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
+ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
++
++ if (cme->data.l[1] == netatom[NetWMSticky]
++ || cme->data.l[2] == netatom[NetWMSticky])
++ setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky)));
+ } else if (cme->message_type == netatom[NetActiveWindow]) {
+ if (c != selmon->sel && !c->isurgent)
+ seturgent(c, 1);
+_AT_@ -1507,6 +1513,23 @@ setfullscreen(Client *c, int fullscreen)
+ }
+ }
+
++void
++ setsticky(Client *c, int sticky)
++ {
++
++ if(sticky && !c->issticky) {
++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
++ PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1);
++ c->issticky = 1;
++ } else if(!sticky && c->issticky){
++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
++ PropModeReplace, (unsigned char *)0, 0);
++ c->issticky = 0;
++ arrange(c->mon);
++ }
++ }
++
++
+ void
+ setlayout(const Arg *arg)
+ {
+_AT_@ -1576,6 +1599,7 @@ setup(void)
+ netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
+ netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
+ netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
++ netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
+ 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);
+_AT_@ -1735,6 +1759,15 @@ togglefloating(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++togglesticky(const Arg *arg)
++{
++ if (!selmon->sel)
++ return;
++ setsticky(selmon->sel, !selmon->sel->issticky);
++ arrange(selmon);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+_AT_@ -2027,6 +2060,9 @@ updatewindowtype(Client *c)
+
+ if (state == netatom[NetWMFullscreen])
+ setfullscreen(c, 1);
++ if (state == netatom[NetWMSticky]) {
++ setsticky(c, 1);
++ }
+ if (wtype == netatom[NetWMWindowTypeDialog])
+ c->isfloating = 1;
+ }
+_AT_@ -2163,3 +2199,4 @@ main(int argc, char *argv[])
+ XCloseDisplay(dpy);
+ return EXIT_SUCCESS;
+ }
++
+--
+2.46.0
+
diff --git a/dwm.suckless.org/patches/sticky/dwm-sticky-6.5.diff b/dwm.suckless.org/patches/sticky/dwm-sticky-6.5.diff
new file mode 100644
index 00000000..055d0193
--- /dev/null
+++ b/dwm.suckless.org/patches/sticky/dwm-sticky-6.5.diff
_AT_@ -0,0 +1,146 @@
+From 60f7034ca1573e10cf9e005e2ef5a44e6b76ea9b Mon Sep 17 00:00:00 2001
+From: elbachir-one <bachiralfa_AT_gmail.com>
+Date: Fri, 27 Sep 2024 12:35:36 +0100
+Subject: [PATCH] Added the missing keybinding
+
+---
+ config.def.h | 1 +
+ dwm.c | 43 ++++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 41 insertions(+), 3 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..55c0a6c 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -95,6 +95,7 @@ static const Key keys[] = {
+ TAGKEYS( XK_8, 7)
+ TAGKEYS( XK_9, 8)
+ { MODKEY|ShiftMask, XK_q, quit, {0} },
++ { MODKEY, XK_s, togglesticky, {0} },
+ };
+
+ /* button definitions */
+diff --git a/dwm.c b/dwm.c
+index 67c6b2b..e8ed755 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -49,7 +49,7 @@
+ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
+ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
+ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
+-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
++#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky)
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+_AT_@ -61,7 +61,7 @@
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { SchemeNorm, SchemeSel }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
++ NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+_AT_@ -92,7 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
+ int bw, oldbw;
+ unsigned int tags;
+- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+_AT_@ -200,6 +200,7 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setsticky(Client *c, int sticky);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+_AT_@ -211,6 +212,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglesticky(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+_AT_@ -525,6 +527,10 @@ clientmessage(XEvent *e)
+ || cme->data.l[2] == netatom[NetWMFullscreen])
+ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
+ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
++
++ if (cme->data.l[1] == netatom[NetWMSticky]
++ || cme->data.l[2] == netatom[NetWMSticky])
++ setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky)));
+ } else if (cme->message_type == netatom[NetActiveWindow]) {
+ if (c != selmon->sel && !c->isurgent)
+ seturgent(c, 1);
+_AT_@ -1507,6 +1513,23 @@ setfullscreen(Client *c, int fullscreen)
+ }
+ }
+
++void
++ setsticky(Client *c, int sticky)
++ {
++
++ if(sticky && !c->issticky) {
++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
++ PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1);
++ c->issticky = 1;
++ } else if(!sticky && c->issticky){
++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
++ PropModeReplace, (unsigned char *)0, 0);
++ c->issticky = 0;
++ arrange(c->mon);
++ }
++ }
++
++
+ void
+ setlayout(const Arg *arg)
+ {
+_AT_@ -1576,6 +1599,7 @@ setup(void)
+ netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
+ netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
+ netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
++ netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
+ 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);
+_AT_@ -1735,6 +1759,15 @@ togglefloating(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++togglesticky(const Arg *arg)
++{
++ if (!selmon->sel)
++ return;
++ setsticky(selmon->sel, !selmon->sel->issticky);
++ arrange(selmon);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+_AT_@ -2027,6 +2060,9 @@ updatewindowtype(Client *c)
+
+ if (state == netatom[NetWMFullscreen])
+ setfullscreen(c, 1);
++ if (state == netatom[NetWMSticky]) {
++ setsticky(c, 1);
++ }
+ if (wtype == netatom[NetWMWindowTypeDialog])
+ c->isfloating = 1;
+ }
+_AT_@ -2163,3 +2199,4 @@ main(int argc, char *argv[])
+ XCloseDisplay(dpy);
+ return EXIT_SUCCESS;
+ }
++
+--
+2.46.0
+
diff --git a/dwm.suckless.org/patches/sticky/index.md b/dwm.suckless.org/patches/sticky/index.md
index d3a43bc1..17d7f96b 100644
--- a/dwm.suckless.org/patches/sticky/index.md
+++ b/dwm.suckless.org/patches/sticky/index.md
_AT_@ -10,9 +10,11 @@ pressing `MODKEY+s` again.
 
 Download
 --------
-* [dwm-sticky-6.4.diff](dwm-sticky-6.4.diff)
-* [dwm-sticky-2022-12-05-d47ba0b.diff](dwm-sticky-2022-12-05-d47ba0b.diff)
+* [dwm-sticky-6.5.diff](dwm-sticky-6.5.diff)
+* [dwm-sticky-20240927-60f7034.diff](dwm-sticky-20240927-60f7034.diff)
 
 Author
 ------
 * Ryan Roden-Corrent <ryan_AT_rcorre.net>
+* [El Bachir](mailto:bachiralfa_AT_gmail.com)
+
Received on Fri Sep 27 2024 - 14:08:35 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 27 2024 - 14:12:51 CEST