summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrafa_99 <raroma09@gmail.com>2022-09-07 01:47:24 +0100
committerrafa_99 <raroma09@gmail.com>2022-09-07 01:47:24 +0100
commit8044f081dacdc1b8043de5a17286c95645adb946 (patch)
tree7b9fe0df1c6c133f78ccde22cb6f7874c40a5f0e
parent84422dce03b2c1f395bfbab58f8c19c440ffe7a5 (diff)
Added sticky windows option
-rw-r--r--config.def.h1
-rw-r--r--dwm.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index 89c76bd..18c7674 100644
--- a/config.def.h
+++ b/config.def.h
@@ -102,6 +102,7 @@ static const 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_Down, moveresize, {.v = "0x 25y 0w 0h" } },
{ MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
{ MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
diff --git a/dwm.c b/dwm.c
index abda686..7710e23 100644
--- a/dwm.c
+++ b/dwm.c
@@ -55,7 +55,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)
@@ -230,6 +230,7 @@ static void tagtoleft(const Arg *arg);
static void tagtoright(const Arg *arg);
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);
@@ -1875,6 +1876,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;