From 7740fa46cbab86a7c10f774604b60d868785ca41 Mon Sep 17 00:00:00 2001 From: gutmet Date: Thu, 4 Nov 2021 16:35:58 +0100 Subject: [PATCH] add option to deactivate swallowing (Meta,Ctrl,s) --- CHANGES | 1 + config.def.h | 1 + dwm.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4b9bdfd..77eb247 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ This version of dwm differs from the original on suckless.org as follows: - applied modified zoomswap patch (added config option zoomswap = 1 for active, = 0 for old behaviour) - applied swallow patch +- added option to dynamically deactivate swallowing - applied modified centered master patch (bound to Mod+c, no centered floating, changed stacking behaviour to always push onto left side) diff --git a/config.def.h b/config.def.h index 4d7b348..f2bade3 100644 --- a/config.def.h +++ b/config.def.h @@ -94,6 +94,7 @@ static Key keys[] = { { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ControlMask, XK_space, togglefloating, {0} }, + { MODKEY|ControlMask, XK_s, toggleswallowing, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ControlMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, diff --git a/dwm.c b/dwm.c index b132d1b..7399fd3 100644 --- a/dwm.c +++ b/dwm.c @@ -255,6 +255,7 @@ static void tagmon(const Arg *arg); static void tile(Monitor *); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void toggleswallowing(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -289,6 +290,7 @@ static Client *termforwin(const Client *c); static pid_t winpid(Window w); /* variables */ +static int swallowing = 1; static Systray *systray = NULL; static Client *prevzoom = NULL; static const char broken[] = "broken"; @@ -477,7 +479,8 @@ attachstack(Client *c) void swallow(Client *p, Client *c) { - + if (!swallowing) + return; if (c->noswallow || c->isterminal) return; if (c->noswallow && !swallowfloating && c->isfloating) @@ -2076,6 +2079,12 @@ togglefloating(const Arg *arg) arrange(selmon); } +void +toggleswallowing(const Arg *arg) +{ + swallowing = !swallowing; +} + void toggletag(const Arg *arg) {