dwm-sticky-6.1.diff (2355B)
1 diff --git a/config.h b/config.h 2 index 7054c06..9b5d5b8 100644 3 --- a/config.h 4 +++ b/config.h 5 @@ -76,6 +76,7 @@ static Key keys[] = { 6 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 7 { MODKEY, XK_space, setlayout, {0} }, 8 { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 9 + { MODKEY, XK_s, togglesticky, {0} }, 10 { MODKEY, XK_0, view, {.ui = ~0 } }, 11 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, 12 { MODKEY, XK_comma, focusmon, {.i = -1 } }, 13 diff --git a/dwm.c b/dwm.c 14 index 0362114..0ef5c7f 100644 15 --- a/dwm.c 16 +++ b/dwm.c 17 @@ -49,7 +49,7 @@ 18 #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) 19 #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ 20 * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) 21 -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) 22 +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) 23 #define LENGTH(X) (sizeof X / sizeof X[0]) 24 #define MOUSEMASK (BUTTONMASK|PointerMotionMask) 25 #define WIDTH(X) ((X)->w + 2 * (X)->bw) 26 @@ -92,7 +92,7 @@ struct Client { 27 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 28 int bw, oldbw; 29 unsigned int tags; 30 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 31 + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky; 32 Client *next; 33 Client *snext; 34 Monitor *mon; 35 @@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); 36 static void tile(Monitor *); 37 static void togglebar(const Arg *arg); 38 static void togglefloating(const Arg *arg); 39 +static void togglesticky(const Arg *arg); 40 static void toggletag(const Arg *arg); 41 static void toggleview(const Arg *arg); 42 static void unfocus(Client *c, int setfocus); 43 @@ -1713,6 +1714,15 @@ togglefloating(const Arg *arg) 44 } 45 46 void 47 +togglesticky(const Arg *arg) 48 +{ 49 + if (!selmon->sel) 50 + return; 51 + selmon->sel->issticky = !selmon->sel->issticky; 52 + arrange(selmon); 53 +} 54 + 55 +void 56 toggletag(const Arg *arg) 57 { 58 unsigned int newtags;