Compare commits
No commits in common. "a2c3113e1f5acf1d16df4f0191750db02b8a3601" and "475ac01b5c6f929ab01a726277dd29d5ddf7ddbe" have entirely different histories.
a2c3113e1f
...
475ac01b5c
12
config.def.h
12
config.def.h
@ -111,12 +111,14 @@ static const Keychord *keychords[] = {
|
|||||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_Return}}, spawn, {.v = termcmd}}),
|
&((Keychord){1, {{MODKEY | ShiftMask, XK_Return}}, spawn, {.v = termcmd}}),
|
||||||
&((Keychord){1, {{MODKEY, XK_Escape}}, spawn, {.v = slockcmd}}),
|
&((Keychord){1, {{MODKEY, XK_Escape}}, spawn, {.v = slockcmd}}),
|
||||||
|
|
||||||
&((Keychord){1, {{MODKEY, XK_l}}, shiftview, {.i = +1}}),
|
&((Keychord){1, {{MODKEY, XK_l}}, shiftviewclients, {.i = +1}}),
|
||||||
&((Keychord){1, {{MODKEY, XK_h}}, shiftview, {.i = -1}}),
|
&((Keychord){1, {{MODKEY, XK_h}}, shiftviewclients, {.i = -1}}),
|
||||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_l}}, shiftboth, {.i = +1}}),
|
&((Keychord){1, {{MODKEY | ShiftMask, XK_l}}, shiftview, {.i = +1}}),
|
||||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_h}}, shiftboth, {.i = -1}}),
|
&((Keychord){1, {{MODKEY | ShiftMask, XK_h}}, shiftview, {.i = -1}}),
|
||||||
&((Keychord){1, {{MODKEY | ControlMask, XK_l}}, swapmon, {0}}),
|
&((Keychord){1, {{MODKEY | ControlMask, XK_l}}, shiftboth, {.i = +1}}),
|
||||||
|
&((Keychord){1, {{MODKEY | ControlMask, XK_h}}, shiftboth, {.i = -1}}),
|
||||||
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_l}}, shiftswaptags, {.i = +1}}),
|
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_l}}, shiftswaptags, {.i = +1}}),
|
||||||
|
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_h}}, shiftswaptags, {.i = -1}}),
|
||||||
|
|
||||||
&((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1}}),
|
&((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1}}),
|
||||||
&((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1}}),
|
&((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1}}),
|
||||||
|
|||||||
@ -1,76 +0,0 @@
|
|||||||
From 4cd2832206eca48190463ac2d3e5ba4e1410c517 Mon Sep 17 00:00:00 2001
|
|
||||||
From: jameel-sawafta <jameelhsawafta@gmail.com>
|
|
||||||
Date: Fri, 9 May 2025 22:47:04 +0300
|
|
||||||
Subject: [PATCH] dwm: add swapmon function to swap monitors
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 1 +
|
|
||||||
dwm.c | 33 +++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 34 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 9efa774..7c229cc 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -85,6 +85,7 @@ static const Key keys[] = {
|
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
|
||||||
+ { MODKEY|ShiftMask, XK_apostrophe, swapmon, {0} },
|
|
||||||
TAGKEYS( XK_1, 0)
|
|
||||||
TAGKEYS( XK_2, 1)
|
|
||||||
TAGKEYS( XK_3, 2)
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index 1443802..adfe8bd 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -232,6 +232,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
|
||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
|
||||||
static void zoom(const Arg *arg);
|
|
||||||
+static void swapmon(const Arg *arg);
|
|
||||||
|
|
||||||
/* variables */
|
|
||||||
static const char broken[] = "broken";
|
|
||||||
@@ -2139,6 +2140,38 @@ zoom(const Arg *arg)
|
|
||||||
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
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.49.0
|
|
||||||
|
|
||||||
33
dwm.c
33
dwm.c
@ -285,7 +285,6 @@ 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 Systray *systray = NULL;
|
static Systray *systray = NULL;
|
||||||
@ -2870,38 +2869,6 @@ 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[])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,7 +53,6 @@ shiftview(const Arg *arg)
|
|||||||
view(&shifted);
|
view(&shifted);
|
||||||
}
|
}
|
||||||
/* Navigate to the next/prev tag that has a client, else moves it to the next/prev tag */
|
/* Navigate to the next/prev tag that has a client, else moves it to the next/prev tag */
|
||||||
/* This doesn't work TODO: work out why this isn't working and fix */
|
|
||||||
void
|
void
|
||||||
shiftviewclients(const Arg *arg)
|
shiftviewclients(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user