swap tags patch
This commit is contained in:
parent
03ebdd7bc6
commit
8cb984e3a6
@ -85,7 +85,8 @@ static const Layout layouts[] = {
|
|||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
|
||||||
|
{ Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
23
dwm.c
23
dwm.c
@ -273,6 +273,7 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
|||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void xinitvisual();
|
static void xinitvisual();
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
static void swaptags(const Arg *arg);
|
||||||
static void autostart_exec(void);
|
static void autostart_exec(void);
|
||||||
|
|
||||||
static pid_t getparentprocess(pid_t p);
|
static pid_t getparentprocess(pid_t p);
|
||||||
@ -3121,6 +3122,28 @@ zoom(const Arg *arg)
|
|||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
swaptags(const Arg *arg)
|
||||||
|
{
|
||||||
|
unsigned int newtag = arg->ui & TAGMASK;
|
||||||
|
unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||||
|
|
||||||
|
if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Client *c = selmon->clients; c != NULL; c = c->next) {
|
||||||
|
if((c->tags & newtag) || (c->tags & curtag))
|
||||||
|
c->tags ^= curtag ^ newtag;
|
||||||
|
|
||||||
|
if(!c->tags) c->tags = newtag;
|
||||||
|
}
|
||||||
|
|
||||||
|
selmon->tagset[selmon->seltags] = newtag;
|
||||||
|
|
||||||
|
focus(NULL);
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
68
patches/functions/dwm-swaptags-6.2.diff
Normal file
68
patches/functions/dwm-swaptags-6.2.diff
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
From 9513cc776dc8114967988d4abc32fd7f37446ddb Mon Sep 17 00:00:00 2001
|
||||||
|
From: fossy <fossy@dnmx.org>
|
||||||
|
Date: Sun, 28 Nov 2021 21:34:37 +0100
|
||||||
|
Subject: [PATCH] Move function and it's prototype from config.def.h to dwm.c
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 3 ++-
|
||||||
|
dwm.c | 23 +++++++++++++++++++++++
|
||||||
|
2 files changed, 25 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a2ac963..f31a66d 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -50,7 +50,8 @@ static const Layout layouts[] = {
|
||||||
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
|
- { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
+ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
|
||||||
|
+ { Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 5e4d494..d11addd 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -234,6 +234,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 swaptags(const Arg *arg);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
@@ -2127,6 +2128,28 @@ zoom(const Arg *arg)
|
||||||
|
pop(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+swaptags(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ unsigned int newtag = arg->ui & TAGMASK;
|
||||||
|
+ unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||||
|
+
|
||||||
|
+ if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ for (Client *c = selmon->clients; c != NULL; c = c->next) {
|
||||||
|
+ if((c->tags & newtag) || (c->tags & curtag))
|
||||||
|
+ c->tags ^= curtag ^ newtag;
|
||||||
|
+
|
||||||
|
+ if(!c->tags) c->tags = newtag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ selmon->tagset[selmon->seltags] = newtag;
|
||||||
|
+
|
||||||
|
+ focus(NULL);
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user