feat: patched swapmonitors
This commit is contained in:
parent
3801367f23
commit
505b6573e9
@ -86,6 +86,7 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_apostrophe, swapmon, {0} },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
|
|||||||
33
dwm.c
33
dwm.c
@ -232,6 +232,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
|||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
static void swapmon(const Arg *arg);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static const char broken[] = "broken";
|
static const char broken[] = "broken";
|
||||||
@ -2140,6 +2141,38 @@ zoom(const Arg *arg)
|
|||||||
pop(c);
|
pop(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
swapmon(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (mons->next == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Monitor *m1 = mons;
|
||||||
|
Monitor *m2 = mons->next;
|
||||||
|
|
||||||
|
unsigned int tmp = m1->tagset[m1->seltags];
|
||||||
|
m1->tagset[m1->seltags] = m2->tagset[m2->seltags];
|
||||||
|
m2->tagset[m2->seltags] = tmp;
|
||||||
|
|
||||||
|
Client *c;
|
||||||
|
for (c = m1->clients; c; c = c->next)
|
||||||
|
c->mon = m2;
|
||||||
|
for (c = m2->clients; c; c = c->next)
|
||||||
|
c->mon = m1;
|
||||||
|
|
||||||
|
Client *tmp_clients = m1->clients;
|
||||||
|
m1->clients = m2->clients;
|
||||||
|
m2->clients = tmp_clients;
|
||||||
|
|
||||||
|
Client *tmp_stack = m1->stack;
|
||||||
|
m1->stack = m2->stack;
|
||||||
|
m2->stack = tmp_stack;
|
||||||
|
|
||||||
|
focus(NULL);
|
||||||
|
arrange(m1);
|
||||||
|
arrange(m2);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user