summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/sticky/sticky.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dwl-patches/patches/sticky/sticky.patch')
-rw-r--r--dwl-patches/patches/sticky/sticky.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/dwl-patches/patches/sticky/sticky.patch b/dwl-patches/patches/sticky/sticky.patch
new file mode 100644
index 0000000..ece8308
--- /dev/null
+++ b/dwl-patches/patches/sticky/sticky.patch
@@ -0,0 +1,85 @@
+From f113cdc0b4cecceaaf28679489852ae61a1aa3f5 Mon Sep 17 00:00:00 2001
+From: Rutherther <rutherther@proton.me>
+Date: Fri, 19 Jul 2024 16:29:43 +0200
+Subject: [PATCH] sticky
+
+---
+ dwl.c | 27 +++++++++++++++++++++++++--
+ 1 file changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/dwl.c b/dwl.c
+index 5bf995e..820f4af 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -73,7 +73,7 @@
+ #define MAX(A, B) ((A) > (B) ? (A) : (B))
+ #define MIN(A, B) ((A) < (B) ? (A) : (B))
+ #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
+-#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
++#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && (((C)->tags & (M)->tagset[(M)->seltags]) || C->issticky))
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define END(A) ((A) + LENGTH(A))
+ #define TAGMASK ((1u << TAGCOUNT) - 1)
+@@ -139,7 +139,7 @@ typedef struct {
+ #endif
+ unsigned int bw;
+ uint32_t tags;
+- int isfloating, isurgent, isfullscreen;
++ int isfloating, isurgent, isfullscreen, issticky;
+ uint32_t resize; /* configure serial of a pending resize */
+ } Client;
+
+@@ -326,6 +326,7 @@ static void setcursor(struct wl_listener *listener, void *data);
+ static void setcursorshape(struct wl_listener *listener, void *data);
+ static void setfloating(Client *c, int floating);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setsticky(Client *c, int sticky);
+ static void setgamma(struct wl_listener *listener, void *data);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+@@ -339,6 +340,7 @@ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglefloating(const Arg *arg);
++static void togglesticky(const Arg *arg);
+ static void togglefullscreen(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+@@ -2351,6 +2353,17 @@ setgamma(struct wl_listener *listener, void *data)
+ wlr_output_schedule_frame(m->wlr_output);
+ }
+
++void
++setsticky(Client *c, int sticky)
++{
++ if(sticky && !c->issticky) {
++ c->issticky = 1;
++ } else if(!sticky && c->issticky) {
++ c->issticky = 0;
++ arrange(c->mon);
++ }
++}
++
+ void
+ setlayout(const Arg *arg)
+ {
+@@ -2738,6 +2751,16 @@ togglefullscreen(const Arg *arg)
+ setfullscreen(sel, !sel->isfullscreen);
+ }
+
++void
++togglesticky(const Arg *arg)
++{
++ Client *c = focustop(selmon);
++ if(!c)
++ return;
++
++ setsticky(c, !c->issticky);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+--
+2.45.2
+