This commit is contained in:
Jacob 2023-07-06 19:46:05 +02:00
parent a0803fae0b
commit d0fbe70f84
2 changed files with 76 additions and 4 deletions

View file

@ -30,8 +30,28 @@ static const char *const autostart[] = {
};
/* tagging */
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static char *usedtags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static char *tags[] = {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
};
static char *usedtags[] = {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
};
static const Rule rules[] = {
/* xprop(1):
@ -127,8 +147,10 @@ static const Key keys[] = {
{ MODKEY, XK_n, incnmaster, {.i = -1 } },
{ MODKEY|ControlMask, XK_i, incnstack, {.i = +1 } },
{ MODKEY|ControlMask, XK_u, incnstack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ControlMask, XK_j, movestack, {.i = +1 } },
{ MODKEY|ControlMask, XK_k, movestack, {.i = -1 } },
{ MODKEY, XK_a, setmfact, {.f = -0.05} },
{ MODKEY, XK_d, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_k, setcfact, {.f = +0.25} },
{ MODKEY|ShiftMask, XK_j, setcfact, {.f = -0.25} },
{ MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },

50
dwm.c
View file

@ -275,6 +275,7 @@ static void hexconv(const char *hex, unsigned short *r, unsigned short *g, unsig
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static void movestack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
@ -778,6 +779,55 @@ buttonpress(XEvent *e)
}
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
checkotherwm(void)
{