-
Notifications
You must be signed in to change notification settings - Fork 30
/
dwm-tagallmon-6.5.diff
88 lines (84 loc) · 2.42 KB
/
dwm-tagallmon-6.5.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From 9a794b105ca65664b497c3fa555465ed300a17f9 Mon Sep 17 00:00:00 2001
From: Bakkeby <[email protected]>
Date: Wed, 26 Jun 2024 22:58:33 +0200
Subject: [PATCH] tagallmon
Move all visible windows to an adjacent monitor.
---
config.def.h | 2 ++
dwm.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/config.def.h b/config.def.h
index 9efa774..a5e5897 100644
--- a/config.def.h
+++ b/config.def.h
@@ -85,6 +85,8 @@ 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|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
+ { MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
diff --git a/dwm.c b/dwm.c
index f1d86b2..d3e93f3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -208,6 +208,7 @@ static void showhide(Client *c);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
+static void tagallmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
@@ -1684,6 +1685,48 @@ tagmon(const Arg *arg)
sendmon(selmon->sel, dirtomon(arg->i));
}
+void
+tagallmon(const Arg *arg)
+{
+ Monitor *m;
+ Client *c, *last, *slast, *next;
+
+ if (!mons->next)
+ return;
+
+ m = dirtomon(arg->i);
+ for (last = m->clients; last && last->next; last = last->next);
+ for (slast = m->stack; slast && slast->snext; slast = slast->snext);
+
+ for (c = selmon->clients; c; c = next) {
+ next = c->next;
+ if (!ISVISIBLE(c))
+ continue;
+ unfocus(c, 1);
+ detach(c);
+ detachstack(c);
+ c->mon = m;
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+ c->next = NULL;
+ c->snext = NULL;
+ if (last)
+ last = last->next = c;
+ else
+ m->clients = last = c;
+ if (slast)
+ slast = slast->snext = c;
+ else
+ m->stack = slast = c;
+ if (c->isfullscreen) {
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ XRaiseWindow(dpy, c->win);
+ }
+ }
+
+ focus(NULL);
+ arrange(NULL);
+}
+
void
tile(Monitor *m)
{
--
2.45.2