commit cebae50fb47f7de644877c1829ce154b2fe3abcc
parent ab3832fc98c88a51e1e024e7010097adc59a8ca0
Author: Alex Balgavy <alex@balgavy.eu>
Date: Fri, 8 Oct 2021 12:36:29 +0200
Patch - sticky
Diffstat:
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/config.h b/config.h
@@ -161,6 +161,7 @@ static Key keys[] = {
{ MODKEY, XK_s, setlayout, {.v = &layouts[5]} }, // bstack
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY|ShiftMask, 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
@@ -59,7 +59,7 @@
#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 ISINC(X) ((X) > 1000 && (X) < 3000)
-#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 PREVSEL 3000
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOD(N,M) ((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))
@@ -105,7 +105,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, isterminal, noswallow;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow, issticky;
pid_t pid;
Client *next;
Client *snext;
@@ -251,6 +251,7 @@ static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void togglesticky(const Arg *arg);
static void togglescratch(const Arg *arg);
static void togglefullscr(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -1984,6 +1985,15 @@ togglescratch(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;