commit fc28f2df97a4c0670efcca54c6cf061ffdc8886d
parent 6dd451c10b1abb61aa7c325a8a2402faa402cefe
Author: Miles Alan <m@milesalan.com>
Date: Sun, 26 Apr 2020 17:06:32 -0500
Add switchcol patch
Diffstat:
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -119,6 +119,10 @@ static Key keys[] = {
{ 0, MODKEY|ShiftMask, XK_c, killclient, {0} },
{ 0, MODKEY|ShiftMask, XK_q, killclient, {0} },
+ { 0, MODKEY|ShiftMask, XK_q, killclient, {0} },
+
+ { 0, MODKEY, XK_semicolon, switchcol, {0} },
+
/* float */
{ 0, MODKEY, XK_n, setlayout, {.v = &layouts[1]} },
/* monocle */
diff --git a/dwm.c b/dwm.c
@@ -223,6 +223,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 switchcol(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
@@ -2061,6 +2062,35 @@ spawn(const Arg *arg)
}
void
+switchcol(const Arg *arg)
+{
+ Client *c, *t;
+ int col = 0;
+ int i;
+
+ if (!selmon->sel)
+ return;
+ for (i = 0, c = nexttiled(selmon->clients); c ;
+ c = nexttiled(c->next), i++) {
+ if (c == selmon->sel)
+ col = (i + 1) > selmon->nmaster;
+ }
+ if (i <= selmon->nmaster)
+ return;
+ for (c = selmon->stack; c; c = c->snext) {
+ if (!ISVISIBLE(c))
+ continue;
+ for (i = 0, t = nexttiled(selmon->clients); t && t != c;
+ t = nexttiled(t->next), i++);
+ if (t && (i + 1 > selmon->nmaster) != col) {
+ focus(c);
+ restack(selmon);
+ break;
+ }
+ }
+}
+
+void
tag(const Arg *arg)
{
if (selmon->sel && arg->ui & TAGMASK) {