aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2020-08-09 09:41:28 +0200
committerOmar Polo <op@omarpolo.com>2020-08-09 09:41:28 +0200
commitf555b86b476815b65c38fc57626ac17bd2a0727f (patch)
treec5c945991d76415dec7efd8d3973142f409d19a7
parent2f6f36c16405fc8e98e7e644a5be43b43a3b63b7 (diff)
downloaddwm-retake-f555b86b476815b65c38fc57626ac17bd2a0727f.tar.gz
dwm-retake-f555b86b476815b65c38fc57626ac17bd2a0727f.tar.bz2
push up/down patch + completely remove dmenu things
-rw-r--r--config.def.h3
-rw-r--r--dwm.c46
2 files changed, 46 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index 9354d14..69751e6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -58,7 +58,6 @@ static const Layout layouts[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
-static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *menucmd[] = { "menu", NULL };
static const char *termcmd[] = { "xterm", NULL };
@@ -73,6 +72,8 @@ static Key keys[] = {
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_j, pushdown, {0} },
+ { MODKEY|ShiftMask, XK_k, pushup, {0} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index 76bb761..dcb769f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -196,7 +196,10 @@ static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
static void pop(Client *);
+static Client *prevtiled(Client *c);
static void propertynotify(XEvent *e);
+static void pushdown(const Arg *arg);
+static void pushup(const Arg *arg);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
@@ -1287,6 +1290,16 @@ pop(Client *c)
arrange(c->mon);
}
+Client *
+prevtiled(Client *c) {
+ Client *p, *r;
+
+ for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
+ if(!p->isfloating && ISVISIBLE(p))
+ r = p;
+ return r;
+}
+
void
propertynotify(XEvent *e)
{
@@ -1325,6 +1338,37 @@ propertynotify(XEvent *e)
}
void
+pushdown(const Arg *arg) {
+ Client *sel = selmon->sel, *c;
+
+ if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
+ return;
+ if((c = nexttiled(sel->next))) {
+ detach(sel);
+ sel->next = c->next;
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
+void
+pushup(const Arg *arg) {
+ Client *sel = selmon->sel, *c;
+
+ if(!sel || sel->isfloating)
+ return;
+ if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
+ detach(sel);
+ sel->next = c;
+ for(c = selmon->clients; c->next != sel->next; c = c->next);
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
+void
quit(const Arg *arg)
{
running = 0;
@@ -1718,8 +1762,6 @@ sigchld(int unused)
void
spawn(const Arg *arg)
{
- if (arg->v == dmenucmd)
- dmenumon[0] = '0' + selmon->num;
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));