added swap focus patch
This commit is contained in:
17
dwm.c
17
dwm.c
@@ -207,6 +207,7 @@ static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
static void spawn(const Arg *arg);
|
||||
static void swapfocus();
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *);
|
||||
@@ -241,6 +242,7 @@ static void bstack(Monitor *m);
|
||||
static void bstackhoriz(Monitor *m);
|
||||
|
||||
/* variables */
|
||||
static Client *prevclient = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
@@ -1672,6 +1674,17 @@ spawn(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
swapfocus()
|
||||
{
|
||||
Client *c;
|
||||
for(c = selmon->clients; c && c != prevclient; c = c->next) ;
|
||||
if(c == prevclient) {
|
||||
focus(prevclient);
|
||||
restack(prevclient->mon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tag(const Arg *arg)
|
||||
{
|
||||
@@ -1789,6 +1802,7 @@ unfocus(Client *c, int setfocus)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
prevclient = c;
|
||||
grabbuttons(c, 0);
|
||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
||||
if (setfocus) {
|
||||
@@ -2177,12 +2191,13 @@ void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
Client *c = selmon->sel;
|
||||
prevclient = nexttiled(selmon->clients);
|
||||
|
||||
if (!selmon->lt[selmon->sellt]->arrange
|
||||
|| (selmon->sel && selmon->sel->isfloating))
|
||||
return;
|
||||
if (c == nexttiled(selmon->clients))
|
||||
if (!c || !(c = nexttiled(c->next)))
|
||||
if (!c || !(c = prevclient = nexttiled(c->next)))
|
||||
return;
|
||||
pop(c);
|
||||
}
|
||||
|
Reference in New Issue
Block a user