Adding swapfocus patch

This commit is contained in:
bakkeby
2020-01-29 08:31:00 +01:00
parent 21ba1d7bb3
commit 5e75da8dd1
10 changed files with 81 additions and 12 deletions

View File

@ -47,12 +47,6 @@ updateholdbarpos(Monitor *m)
{
m->wy = m->my;
m->wh = m->mh;
// if (m->showbar) {
// m->by = m->topbar ? m->wy : m->wy + m->wh - bh;
// m->wy = m->topbar ? m->wy - bh + bh : m->wy;
// } else {
// m->by = -bh;
// }
#if EXTRABAR_PATCH
#if BARPADDING_PATCH
m->wh = m->wh - vertpad * m->showbar * 2 - bh * m->showbar * 2;

View File

@ -101,7 +101,10 @@
#endif
#if SWALLOW_PATCH
#include "swallow.c"
#endif // SWALLOW_PATCH
#endif
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.c"
#endif
#if SWITCHCOL_PATCH
#include "switchcol.c"
#endif

View File

@ -101,7 +101,10 @@
#endif
#if SWALLOW_PATCH
#include "swallow.h"
#endif // SWALLOW_PATCH
#endif
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.h"
#endif
#if SWITCHCOL_PATCH
#include "switchcol.h"
#endif
@ -183,4 +186,4 @@
#endif
#if TILE_LAYOUT
#include "tile.h"
#endif
#endif

View File

@ -16,6 +16,9 @@ struct Pertag {
#if ZOOMSWAP_PATCH
Client *prevzooms[LENGTH(tags) + 1]; /* store zoom information */
#endif // ZOOMSWAP_PATCH
#if SWAPFOCUS_PATCH
Client *prevclient[LENGTH(tags) + 1];
#endif // SWAPFOCUS_PATCH
};
void
@ -56,6 +59,4 @@ pertagview(const Arg *arg)
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
#endif // PERTAGBAR_PATCH
// strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); // ??
// strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
}

21
patch/swapfocus.c Normal file
View File

@ -0,0 +1,21 @@
void
swapfocus(const Arg *arg)
{
if (!selmon->sel)
return;
if (selmon->pertag->prevclient[selmon->pertag->curtag] != NULL
&& ISVISIBLE(selmon->pertag->prevclient[selmon->pertag->curtag])) {
focus(selmon->pertag->prevclient[selmon->pertag->curtag]);
restack(selmon->pertag->prevclient[selmon->pertag->curtag]->mon);
}
else {
Client *c = NULL;
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
if (!c)
for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next);
if (c) {
focus(c);
restack(selmon);
}
}
}

1
patch/swapfocus.h Normal file
View File

@ -0,0 +1 @@
static void swapfocus(const Arg *arg);