-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swallow: better fullscreen support ref. #85
- Loading branch information
Showing
3 changed files
with
149 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
From e167b026b6dac825e4d5ad108553674ca7380ccb Mon Sep 17 00:00:00 2001 | ||
From 675be29a39db061dcd405f575d849c05af053a14 Mon Sep 17 00:00:00 2001 | ||
From: Bakkeby <[email protected]> | ||
Date: Wed, 26 Jun 2024 23:04:00 +0200 | ||
Subject: [PATCH] Alternative swallow patch that replaces clients instead of | ||
swapping windows offering better resize hints | ||
|
||
--- | ||
config.def.h | 9 +- | ||
config.def.h | 10 +- | ||
config.mk | 6 +- | ||
dwm.c | 300 +++++++++++++++++++++++++++++++++++++++++++++++---- | ||
3 files changed, 288 insertions(+), 27 deletions(-) | ||
dwm.c | 317 +++++++++++++++++++++++++++++++++++++++++++++++---- | ||
3 files changed, 306 insertions(+), 27 deletions(-) | ||
|
||
diff --git a/config.def.h b/config.def.h | ||
index 9efa774..5dc3f22 100644 | ||
index 9efa774..776d579 100644 | ||
--- a/config.def.h | ||
+++ b/config.def.h | ||
@@ -3,6 +3,7 @@ | ||
@@ -3,6 +3,8 @@ | ||
/* appearance */ | ||
static const unsigned int borderpx = 1; /* border pixel of windows */ | ||
static const unsigned int snap = 32; /* snap pixel */ | ||
+static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ | ||
+static const int swterminheritfs = 1; /* 1 terminal inherits fullscreen on unswallow, 0 otherwise */ | ||
static const int showbar = 1; /* 0 means no bar */ | ||
static const int topbar = 1; /* 0 means bottom bar */ | ||
static const char *fonts[] = { "monospace:size=10" }; | ||
@@ -26,9 +27,11 @@ static const Rule rules[] = { | ||
@@ -26,9 +28,11 @@ static const Rule rules[] = { | ||
* WM_CLASS(STRING) = instance, class | ||
* WM_NAME(STRING) = title | ||
*/ | ||
|
@@ -58,7 +59,7 @@ index 8efca9a..fc05587 100644 | |
# flags | ||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} | ||
diff --git a/dwm.c b/dwm.c | ||
index f1d86b2..7aef964 100644 | ||
index f1d86b2..4ae052f 100644 | ||
--- a/dwm.c | ||
+++ b/dwm.c | ||
@@ -40,6 +40,12 @@ | ||
|
@@ -256,7 +257,7 @@ index f1d86b2..7aef964 100644 | |
} | ||
|
||
void | ||
@@ -1275,6 +1327,46 @@ recttomon(int x, int y, int w, int h) | ||
@@ -1275,6 +1327,66 @@ recttomon(int x, int y, int w, int h) | ||
return r; | ||
} | ||
|
||
|
@@ -268,42 +269,62 @@ index f1d86b2..7aef964 100644 | |
+ | ||
+ new->mon = mon; | ||
+ new->tags = old->tags; | ||
+ new->isfloating = old->isfloating; | ||
+ | ||
+ new->next = old->next; | ||
+ new->snext = old->snext; | ||
+ | ||
+ if (old == mon->clients) | ||
+ if (old == mon->clients) { | ||
+ mon->clients = new; | ||
+ else { | ||
+ } else { | ||
+ for (c = mon->clients; c && c->next != old; c = c->next); | ||
+ c->next = new; | ||
+ } | ||
+ | ||
+ if (old == mon->stack) | ||
+ if (old == mon->stack) { | ||
+ mon->stack = new; | ||
+ else { | ||
+ } else { | ||
+ for (c = mon->stack; c && c->snext != old; c = c->snext); | ||
+ c->snext = new; | ||
+ } | ||
+ | ||
+ old->next = NULL; | ||
+ old->snext = NULL; | ||
+ | ||
+ if (!swterminheritfs && new->isterminal && !new->isfullscreen && old->isfullscreen) { | ||
+ /* Do not allow a non-fullscreen terminal to inherit the fullscreen property of | ||
+ * a windoww when unswallowed */ | ||
+ new->x = old->oldx; | ||
+ new->y = old->oldy; | ||
+ new->w = old->oldw; | ||
+ new->h = old->oldh; | ||
+ new->isfloating = old->oldstate; | ||
+ } else { | ||
+ setfullscreen(new, old->isfullscreen); | ||
+ new->x = old->x; | ||
+ new->y = old->y; | ||
+ new->w = old->w; | ||
+ new->h = old->h; | ||
+ new->oldx = old->oldx; | ||
+ new->oldy = old->oldy; | ||
+ new->oldw = old->oldw; | ||
+ new->oldh = old->oldh; | ||
+ new->oldbw = old->oldbw; | ||
+ new->bw = old->bw; | ||
+ new->isfloating = old->isfloating; | ||
+ new->oldstate = old->oldstate; | ||
+ } | ||
+ | ||
+ XMoveWindow(dpy, old->win, WIDTH(old) * -2, old->y); | ||
+ | ||
+ if (ISVISIBLE(new) && !new->isfullscreen) { | ||
+ if (new->isfloating) | ||
+ resize(new, old->x, old->y, new->w, new->h, 0); | ||
+ else | ||
+ resize(new, old->x, old->y, old->w, old->h, 0); | ||
+ if (ISVISIBLE(new) && new->isfloating && !new->isfullscreen) { | ||
+ resize(new, new->x, new->y, new->w, new->h, 0); | ||
+ } | ||
+} | ||
+ | ||
void | ||
resize(Client *c, int x, int y, int w, int h, int interact) | ||
{ | ||
@@ -1666,6 +1758,31 @@ spawn(const Arg *arg) | ||
@@ -1666,6 +1778,28 @@ spawn(const Arg *arg) | ||
} | ||
} | ||
|
||
|
@@ -312,12 +333,9 @@ index f1d86b2..7aef964 100644 | |
+{ | ||
+ if (c->noswallow || c->isterminal) | ||
+ return 0; | ||
+ if (!swallowfloating && c->isfloating) | ||
+ if (!swallowfloating && (c->isfullscreen ? c->oldstate : c->isfloating)) | ||
+ return 0; | ||
+ | ||
+ if (t->isfullscreen) | ||
+ setfullscreen(c, 1); | ||
+ | ||
+ replaceclient(t, c); | ||
+ c->ignorecfgreqpos = 1; | ||
+ c->swallowing = t; | ||
|
@@ -335,7 +353,7 @@ index f1d86b2..7aef964 100644 | |
void | ||
tag(const Arg *arg) | ||
{ | ||
@@ -1778,9 +1895,17 @@ unfocus(Client *c, int setfocus) | ||
@@ -1778,9 +1912,17 @@ unfocus(Client *c, int setfocus) | ||
void | ||
unmanage(Client *c, int destroyed) | ||
{ | ||
|
@@ -353,7 +371,7 @@ index f1d86b2..7aef964 100644 | |
detach(c); | ||
detachstack(c); | ||
if (!destroyed) { | ||
@@ -2062,6 +2187,133 @@ view(const Arg *arg) | ||
@@ -2062,6 +2204,133 @@ view(const Arg *arg) | ||
arrange(selmon); | ||
} | ||
|
||
|
@@ -487,7 +505,7 @@ index f1d86b2..7aef964 100644 | |
Client * | ||
wintoclient(Window w) | ||
{ | ||
@@ -2151,10 +2403,12 @@ main(int argc, char *argv[]) | ||
@@ -2151,10 +2420,12 @@ main(int argc, char *argv[]) | ||
fputs("warning: no locale support\n", stderr); | ||
if (!(dpy = XOpenDisplay(NULL))) | ||
die("dwm: cannot open display"); | ||
|
@@ -502,5 +520,5 @@ index f1d86b2..7aef964 100644 | |
#endif /* __OpenBSD__ */ | ||
scan(); | ||
-- | ||
2.45.2 | ||
2.46.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
From 1418a2c1fbb8e8ed8347a73f2022cf8cb1d5f091 Mon Sep 17 00:00:00 2001 | ||
From 58dfd781f3c7caf64f8dd35e49bf386ad0351ce0 Mon Sep 17 00:00:00 2001 | ||
From: Bakkeby <[email protected]> | ||
Date: Mon, 1 Jul 2024 23:31:40 +0200 | ||
Subject: [PATCH 2/2] Adding riodraw on top of swallow | ||
Subject: [PATCH 3/3] Adding riodraw on top of swallow | ||
|
||
--- | ||
config.def.h | 8 ++++ | ||
dwm.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++- | ||
2 files changed, 135 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/config.def.h b/config.def.h | ||
index 5dc3f22..664a1ad 100644 | ||
index 776d579..37931c5 100644 | ||
--- a/config.def.h | ||
+++ b/config.def.h | ||
@@ -6,6 +6,12 @@ static const unsigned int snap = 32; /* snap pixel */ | ||
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ | ||
@@ -7,6 +7,12 @@ static const int swallowfloating = 0; /* 1 means swallow floating wind | ||
static const int swterminheritfs = 1; /* 1 terminal inherits fullscreen on unswallow, 0 otherwise */ | ||
static const int showbar = 1; /* 0 means no bar */ | ||
static const int topbar = 1; /* 0 means bottom bar */ | ||
+static const char slopspawnstyle[] = "-t 0 -c 0.92,0.85,0.69,0.3 -o"; /* do NOT define -f (format) here */ | ||
|
@@ -25,7 +25,7 @@ index 5dc3f22..664a1ad 100644 | |
static const char *fonts[] = { "monospace:size=10" }; | ||
static const char dmenufont[] = "monospace:size=10"; | ||
static const char col_gray1[] = "#222222"; | ||
@@ -67,6 +73,8 @@ static const Key keys[] = { | ||
@@ -68,6 +74,8 @@ static const Key keys[] = { | ||
/* modifier key function argument */ | ||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, | ||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, | ||
|
@@ -35,7 +35,7 @@ index 5dc3f22..664a1ad 100644 | |
{ MODKEY, XK_j, focusstack, {.i = +1 } }, | ||
{ MODKEY, XK_k, focusstack, {.i = -1 } }, | ||
diff --git a/dwm.c b/dwm.c | ||
index 7aef964..5f2162e 100644 | ||
index afa3ca2..8818af7 100644 | ||
--- a/dwm.c | ||
+++ b/dwm.c | ||
@@ -205,6 +205,10 @@ static void resize(Client *c, int x, int y, int w, int h, int interact); | ||
|
@@ -85,7 +85,7 @@ index 7aef964..5f2162e 100644 | |
arrange(c->mon); | ||
XMapWindow(dpy, c->win); | ||
if (focusclient) | ||
@@ -1471,6 +1490,105 @@ restack(Monitor *m) | ||
@@ -1492,6 +1511,105 @@ restack(Monitor *m) | ||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
} | ||
|
||
|
@@ -191,7 +191,7 @@ index 7aef964..5f2162e 100644 | |
void | ||
run(void) | ||
{ | ||
@@ -1739,11 +1857,18 @@ showhide(Client *c) | ||
@@ -1760,11 +1878,18 @@ showhide(Client *c) | ||
void | ||
spawn(const Arg *arg) | ||
{ | ||
|
@@ -211,7 +211,7 @@ index 7aef964..5f2162e 100644 | |
if (dpy) | ||
close(ConnectionNumber(dpy)); | ||
setsid(); | ||
@@ -1756,6 +1881,7 @@ spawn(const Arg *arg) | ||
@@ -1777,6 +1902,7 @@ spawn(const Arg *arg) | ||
execvp(((char **)arg->v)[0], (char **)arg->v); | ||
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]); | ||
} | ||
|
@@ -220,5 +220,5 @@ index 7aef964..5f2162e 100644 | |
|
||
int | ||
-- | ||
2.45.2 | ||
2.46.0 | ||
|
Oops, something went wrong.