Applied focus adjacent tag patch. Required some manual patching due to two hunk failures.

This commit is contained in:
jon
2019-12-24 08:34:08 -06:00
parent 61b5d9251c
commit 919619109c
8 changed files with 517 additions and 2601 deletions

48
dwm.c
View File

@@ -240,6 +240,8 @@ static void spawn(const Arg *arg);
static Monitor *systraytomon(Monitor *m);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tagtoleft(const Arg *arg);
static void tagtoright(const Arg *arg);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
@@ -262,6 +264,8 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
static void viewtoleft(const Arg *arg);
static void viewtoright(const Arg *arg);
static void warp(const Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
@@ -1655,6 +1659,28 @@ setclientstate(Client *c, long state)
PropModeReplace, (unsigned char *)data, 2);
}
void
tagtoleft(const Arg *arg) {
if(selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
focus(NULL);
arrange(selmon);
}
}
void
tagtoright(const Arg *arg) {
if(selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
focus(NULL);
arrange(selmon);
}
}
int
sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
{
@@ -2496,6 +2522,28 @@ warp(const Client *c)
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}
void
viewtoleft(const Arg *arg) {
if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoright(const Arg *arg) {
if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(NULL);
arrange(selmon);
}
}
Client *
wintoclient(Window w)
{