Compare commits
3 Commits
654d526235
...
461498821f
Author | SHA1 | Date | |
---|---|---|---|
|
461498821f | ||
|
ede27072ae | ||
2b289702da |
@ -45,7 +45,7 @@ static const char *const autostart[] = {
|
|||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
/* launcher commands (They must be NULL terminated) */
|
/* launcher commands (They must be NULL terminated) */
|
||||||
static const char* browser[] = { "firefox", "--newwindow", "search.brave.com", NULL };
|
static const char* browser[] = { "firefox", "search.brave.com", NULL };
|
||||||
static const char* terminal[] = { "st", NULL };
|
static const char* terminal[] = { "st", NULL };
|
||||||
|
|
||||||
static const Launcher launchers[] = {
|
static const Launcher launchers[] = {
|
||||||
@ -116,13 +116,10 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_k, focusstackvis, {.i = -1 } },
|
{ MODKEY, XK_k, focusstackvis, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_j, focusstackhid, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_j, focusstackhid, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_k, focusstackhid, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_k, focusstackhid, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
|
|
||||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY, XK_r, resetlayout, {0} },
|
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
67
dwm.c
67
dwm.c
@ -218,13 +218,11 @@ static void maprequest(XEvent *e);
|
|||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static void movestack(const Arg *arg);
|
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *c);
|
static void pop(Client *c);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void resetlayout(const Arg *arg);
|
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||||
static void resizemouse(const Arg *arg);
|
static void resizemouse(const Arg *arg);
|
||||||
@ -1653,55 +1651,6 @@ nexttiled(Client *c)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
movestack(const Arg *arg) {
|
|
||||||
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
|
||||||
|
|
||||||
if(arg->i > 0) {
|
|
||||||
/* find the client after selmon->sel */
|
|
||||||
for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
|
||||||
if(!c)
|
|
||||||
for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* find the client before selmon->sel */
|
|
||||||
for(i = selmon->clients; i != selmon->sel; i = i->next)
|
|
||||||
if(ISVISIBLE(i) && !i->isfloating)
|
|
||||||
c = i;
|
|
||||||
if(!c)
|
|
||||||
for(; i; i = i->next)
|
|
||||||
if(ISVISIBLE(i) && !i->isfloating)
|
|
||||||
c = i;
|
|
||||||
}
|
|
||||||
/* find the client before selmon->sel and c */
|
|
||||||
for(i = selmon->clients; i && (!p || !pc); i = i->next) {
|
|
||||||
if(i->next == selmon->sel)
|
|
||||||
p = i;
|
|
||||||
if(i->next == c)
|
|
||||||
pc = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* swap c and selmon->sel selmon->clients in the selmon->clients list */
|
|
||||||
if(c && c != selmon->sel) {
|
|
||||||
Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next;
|
|
||||||
selmon->sel->next = c->next==selmon->sel?c:c->next;
|
|
||||||
c->next = temp;
|
|
||||||
|
|
||||||
if(p && p != c)
|
|
||||||
p->next = c;
|
|
||||||
if(pc && pc != selmon->sel)
|
|
||||||
pc->next = selmon->sel;
|
|
||||||
|
|
||||||
if(selmon->sel == selmon->clients)
|
|
||||||
selmon->clients = c;
|
|
||||||
else if(c == selmon->clients)
|
|
||||||
selmon->clients = selmon->sel;
|
|
||||||
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pop(Client *c)
|
pop(Client *c)
|
||||||
{
|
{
|
||||||
@ -1786,19 +1735,6 @@ recttomon(int x, int y, int w, int h)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
resetlayout(const Arg *arg)
|
|
||||||
{
|
|
||||||
Arg default_layout = {.v = &layouts[0]};
|
|
||||||
Arg default_mfact = {.f = mfact + 1};
|
|
||||||
|
|
||||||
setlayout(&default_layout);
|
|
||||||
setmfact(&default_mfact);
|
|
||||||
|
|
||||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = nmaster;
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||||
{
|
{
|
||||||
@ -1819,9 +1755,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||||||
c->oldh = c->h; c->h = wc.height = h;
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
|
|
||||||
if ((nexttiled(c->mon->clients) == c) && !(nexttiled(c->next)))
|
|
||||||
resetlayout(NULL);
|
|
||||||
|
|
||||||
for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
|
for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
|
||||||
|
|
||||||
if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
|
if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
From 4df827a2ec7820f41bdb8576cc39b55fbf35be44 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jack Bird <jack.bird@durham.ac.uk>
|
|
||||||
Date: Mon, 16 Aug 2021 23:25:16 +0100
|
|
||||||
Subject: [PATCH] Patch applies cleanly
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 1 +
|
|
||||||
dwm.c | 15 +++++++++++++++
|
|
||||||
2 files changed, 16 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 1c0b587..5d118cf 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -70,6 +70,7 @@ static Key keys[] = {
|
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
|
||||||
+ { MODKEY, XK_r, resetlayout, {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 4465af1..77727ea 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -188,6 +188,7 @@ static void pop(Client *);
|
|
||||||
static void propertynotify(XEvent *e);
|
|
||||||
static void quit(const Arg *arg);
|
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
|
||||||
+static void resetlayout(const Arg *arg);
|
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
|
||||||
static void resizemouse(const Arg *arg);
|
|
||||||
@@ -1265,6 +1266,16 @@ recttomon(int x, int y, int w, int h)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+resetlayout(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ Arg default_layout = {.v = &layouts[0]};
|
|
||||||
+ Arg default_mfact = {.f = mfact + 1};
|
|
||||||
+
|
|
||||||
+ setlayout(&default_layout);
|
|
||||||
+ setmfact(&default_mfact);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
|
||||||
{
|
|
||||||
@@ -1282,6 +1293,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|
||||||
c->oldw = c->w; c->w = wc.width = w;
|
|
||||||
c->oldh = c->h; c->h = wc.height = h;
|
|
||||||
wc.border_width = c->bw;
|
|
||||||
+
|
|
||||||
+ if ((nexttiled(c->mon->clients) == c) && !(nexttiled(c->next)))
|
|
||||||
+ resetlayout(NULL);
|
|
||||||
+
|
|
||||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
|
||||||
configure(c);
|
|
||||||
XSync(dpy, False);
|
|
||||||
--
|
|
||||||
2.32.0
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
diff -r -u a/config.def.h b/config.def.h
|
|
||||||
--- a/config.def.h 2022-01-07 06:42:18.000000000 -0500
|
|
||||||
+++ b/config.def.h 2022-01-23 16:03:42.521951418 -0500
|
|
||||||
@@ -69,6 +69,7 @@
|
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
|
||||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
|
||||||
+ { MODKEY, XK_o, resetnmaster, {0} },
|
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
|
||||||
diff -r -u a/dwm.c b/dwm.c
|
|
||||||
--- a/dwm.c 2022-01-23 16:06:01.221948285 -0500
|
|
||||||
+++ b/dwm.c 2022-01-23 16:05:35.949948855 -0500
|
|
||||||
@@ -191,6 +191,7 @@
|
|
||||||
static void propertynotify(XEvent *e);
|
|
||||||
static void quit(const Arg *arg);
|
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
|
||||||
+static void resetnmaster(const Arg *arg);
|
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
|
||||||
static void resizemouse(const Arg *arg);
|
|
||||||
@@ -1296,6 +1297,13 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
+resetnmaster(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = 1;
|
|
||||||
+ arrange(selmon);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
|
||||||
{
|
|
||||||
if (applysizehints(c, &x, &y, &w, &h, interact))
|
|
@ -1,95 +0,0 @@
|
|||||||
From 9a4037dc0ef56f91c009317e78e9e3790dafbb58 Mon Sep 17 00:00:00 2001
|
|
||||||
From: BrunoCooper17 <BrunoCooper17@outlook.com>
|
|
||||||
Date: Mon, 15 Nov 2021 14:04:53 -0600
|
|
||||||
Subject: [PATCH] MoveStack patch
|
|
||||||
|
|
||||||
This plugin allows you to move clients around in the stack and swap them
|
|
||||||
with the master. It emulates the behavior off mod+shift+j and mod+shift+k
|
|
||||||
in Xmonad. movestack(+1) will swap the client with the current focus with
|
|
||||||
the next client. movestack(-1) will swap the client with the current focus
|
|
||||||
with the previous client.
|
|
||||||
---
|
|
||||||
config.def.h | 3 +++
|
|
||||||
movestack.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 51 insertions(+)
|
|
||||||
create mode 100644 movestack.c
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index a2ac963..33efa5b 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -60,6 +60,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
|
||||||
static const char *termcmd[] = { "st", NULL };
|
|
||||||
|
|
||||||
+#include "movestack.c"
|
|
||||||
static Key keys[] = {
|
|
||||||
/* modifier key function argument */
|
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
|
||||||
@@ -71,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, movestack, {.i = +1 } },
|
|
||||||
+ { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
|
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
|
||||||
diff --git a/movestack.c b/movestack.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..520f4ae
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/movestack.c
|
|
||||||
@@ -0,0 +1,48 @@
|
|
||||||
+void
|
|
||||||
+movestack(const Arg *arg) {
|
|
||||||
+ Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
|
||||||
+
|
|
||||||
+ if(arg->i > 0) {
|
|
||||||
+ /* find the client after selmon->sel */
|
|
||||||
+ for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
|
||||||
+ if(!c)
|
|
||||||
+ for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ /* find the client before selmon->sel */
|
|
||||||
+ for(i = selmon->clients; i != selmon->sel; i = i->next)
|
|
||||||
+ if(ISVISIBLE(i) && !i->isfloating)
|
|
||||||
+ c = i;
|
|
||||||
+ if(!c)
|
|
||||||
+ for(; i; i = i->next)
|
|
||||||
+ if(ISVISIBLE(i) && !i->isfloating)
|
|
||||||
+ c = i;
|
|
||||||
+ }
|
|
||||||
+ /* find the client before selmon->sel and c */
|
|
||||||
+ for(i = selmon->clients; i && (!p || !pc); i = i->next) {
|
|
||||||
+ if(i->next == selmon->sel)
|
|
||||||
+ p = i;
|
|
||||||
+ if(i->next == c)
|
|
||||||
+ pc = i;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* swap c and selmon->sel selmon->clients in the selmon->clients list */
|
|
||||||
+ if(c && c != selmon->sel) {
|
|
||||||
+ Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next;
|
|
||||||
+ selmon->sel->next = c->next==selmon->sel?c:c->next;
|
|
||||||
+ c->next = temp;
|
|
||||||
+
|
|
||||||
+ if(p && p != c)
|
|
||||||
+ p->next = c;
|
|
||||||
+ if(pc && pc != selmon->sel)
|
|
||||||
+ pc->next = selmon->sel;
|
|
||||||
+
|
|
||||||
+ if(selmon->sel == selmon->clients)
|
|
||||||
+ selmon->clients = c;
|
|
||||||
+ else if(c == selmon->clients)
|
|
||||||
+ selmon->clients = selmon->sel;
|
|
||||||
+
|
|
||||||
+ arrange(selmon);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
\ No newline at end of file
|
|
||||||
--
|
|
||||||
2.33.1
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user