sticky patch

This commit is contained in:
Luke Smith 2019-12-14 17:25:52 -05:00
parent 73da539a90
commit cef8e1eaf3
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
2 changed files with 13 additions and 2 deletions

View file

@ -89,6 +89,7 @@ static Key keys[] = {
{ MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_s, togglesticky, {0} },
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },

14
dwm.c
View file

@ -50,7 +50,7 @@
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #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)) \ #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))) * 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 LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define WIDTH(X) ((X)->w + 2 * (X)->bw) #define WIDTH(X) ((X)->w + 2 * (X)->bw)
@ -108,7 +108,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw; int bw, oldbw;
unsigned int tags; unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
Client *next; Client *next;
Client *snext; Client *snext;
Monitor *mon; Monitor *mon;
@ -228,6 +228,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *); static void tile(Monitor *);
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglesticky(const Arg *arg);
static void togglefullscr(const Arg *arg); static void togglefullscr(const Arg *arg);
static void togglescratch(const Arg *arg); static void togglescratch(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
@ -1812,6 +1813,15 @@ togglefullscr(const Arg *arg)
setfullscreen(selmon->sel, !selmon->sel->isfullscreen); setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
} }
void
togglesticky(const Arg *arg)
{
if (!selmon->sel)
return;
selmon->sel->issticky = !selmon->sel->issticky;
arrange(selmon);
}
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {