commit 934dca2fbaa578f582c71ad176b93708bd4ae715
parent f1be663bd9f766f233cde15ec52c1ff64c1c1792
Author: AndrewLockVI <andrew@laack.co>
Date: Sat, 15 Feb 2025 22:59:48 -0600
Patched in switching window positions and updated shortcut for switching between monitors.
Diffstat:
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/config.h b/config.h
@@ -14,12 +14,11 @@ static const char col_lg[] = "#aaaaaa";
static const char col_gray1[] = "#444444";
static const char col_green[] = "#00ff00";
-static const char col_lt_green[] = "#00bb00";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_lg, col_black, col_black },
- [SchemeSel] = { col_white, col_lt_green, col_green },
+ [SchemeSel] = { col_white, col_green, col_green },
};
/* tagging */
@@ -77,6 +76,8 @@ static const char *suspendcmd[] = {"/home/andrew/bin/suspend.sh" , NULL};
static const char *termcmd[] = { "st", NULL };
+#include "movestack.c"
+
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_o, spawn, {.v = dmenucmd } },
@@ -106,7 +107,8 @@ static const Key keys[] = {
//{ MODKEY, XK_Tab, view, {0} },
-
+ { MODKEY|ShiftMask, XK_Down, movestack, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_Up, movestack, {.i = -1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
@@ -138,8 +140,9 @@ static const Key keys[] = {
//{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
//{ MODKEY, XK_0, view, {.ui = ~0 } },
//{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
- { MODKEY|ShiftMask, XK_Up, focusmon, {.i = -1 } },
- { MODKEY|ShiftMask, XK_Down, focusmon, {.i = +1 } },
+
+ { MODKEY|ShiftMask, XK_m, focusmon, {.i = -1 } },
+ //{ MODKEY|ShiftMask, XK_Down, focusmon, {.i = +1 } },
//{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
//{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
diff --git a/movestack.c 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);
+ }
+}