[wiki] [sites] Add a patch for sticky clients in dwm. || Ryan Roden-Corrent

From: <git_AT_suckless.org>
Date: Mon, 12 Sep 2016 02:31:56 +0200

commit 1fa4fdc12e93ad66677787610fb20a456538472a
Author: Ryan Roden-Corrent <ryan_AT_rcorre.net>
Date: Sun Sep 11 20:28:45 2016 -0400

    Add a patch for sticky clients in dwm.
    
    MOD+s will toggle the sticky bit on the selected client. A sticky client
    is shown on all tags. I got the idea from AwesomeWM, though it probably
    appears elsewhere as well.

diff --git a/dwm.suckless.org/patches/dwm-sticky-20160911-ab9571b.diff b/dwm.suckless.org/patches/dwm-sticky-20160911-ab9571b.diff
new file mode 100644
index 0000000..f383d9b
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-sticky-20160911-ab9571b.diff
_AT_@ -0,0 +1,58 @@
+diff --git a/config.def.h b/config.def.h
+index fd77a07..9b743a5 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -78,6 +78,7 @@ static Key keys[] = {
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
++ { MODKEY, XK_s, togglesticky, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+ { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
+ { MODKEY, XK_comma, focusmon, {.i = -1 } },
+diff --git a/dwm.c b/dwm.c
+index 421bf27..602338a 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_@ -93,7 +93,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ 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_@ -212,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);
++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_@ -1712,6 +1713,15 @@ togglefloating(const Arg *arg)
+ }
+
+ void
++togglesticky(const Arg *arg)
++{
++ if (!selmon->sel)
++ return;
++ selmon->sel->issticky = !selmon->sel->issticky;
++ arrange(selmon);
++}
++
++void
+ toggletag(const Arg *arg)
+ {
+ unsigned int newtags;
diff --git a/dwm.suckless.org/patches/dwm-sticky-6.1.diff b/dwm.suckless.org/patches/dwm-sticky-6.1.diff
new file mode 100644
index 0000000..0defebc
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-sticky-6.1.diff
_AT_@ -0,0 +1,58 @@
+diff --git a/config.def.h b/config.def.h
+index 7054c06..9b5d5b8 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -76,6 +76,7 @@ static Key keys[] = {
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
++ { MODKEY, XK_s, togglesticky, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+ { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
+ { MODKEY, XK_comma, focusmon, {.i = -1 } },
+diff --git a/dwm.c b/dwm.c
+index 0362114..0ef5c7f 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_@ -92,7 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ 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_@ -211,6 +211,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 togglesticky(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+_AT_@ -1713,6 +1714,15 @@ togglefloating(const Arg *arg)
+ }
+
+ void
++togglesticky(const Arg *arg)
++{
++ if (!selmon->sel)
++ return;
++ selmon->sel->issticky = !selmon->sel->issticky;
++ arrange(selmon);
++}
++
++void
+ toggletag(const Arg *arg)
+ {
+ unsigned int newtags;
diff --git a/dwm.suckless.org/patches/sticky.md b/dwm.suckless.org/patches/sticky.md
new file mode 100644
index 0000000..6387700
--- /dev/null
+++ b/dwm.suckless.org/patches/sticky.md
_AT_@ -0,0 +1,16 @@
+# sticky
+
+## Description
+
+Press `MODKEY+s` (default) to make a client 'sticky'. A sticky client is visible
+on all tags. This is similar to setting the client's `tags` to all 1's, but with
+the ability to easily return it to its original tag by toggling it off by
+pressing `MODKEY+s` again.
+
+## Download
+
+ * [dwm-sticky-6.1.diff](dwm-sticky-6.1.diff)
+ * [dwm-sticky-20160911-ab9571b.diff](dwm-sticky-20160911-ab9571b.diff)
+
+## Author
+ * Ryan Roden-Corrent <ryan_AT_rcorre.net>
Received on Mon Sep 12 2016 - 02:31:56 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 12 2016 - 02:36:18 CEST