diff --git a/README.md b/README.md index 5a4cd34..e5c5309 100644 --- a/README.md +++ b/README.md @@ -70,3 +70,4 @@ Most patches can be found on the suckless website: [https://dwm.suckless.org/pat * [movestack](https://dwm.suckless.org/patches/movestack/) - Move clients around in the stack and swap them with the master * [noborder](https://dwm.suckless.org/patches/noborder/) (Floating Fix) - Remove the border when there is only one window visible * [swallow](https://dwm.suckless.org/patches/swallow/) - Programs opened from terminal will "swallow" the terminal +* [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/) - Resets `isfloating` on any visible windows that have it set diff --git a/config.def.h b/config.def.h index e1a9e7f..d71a47e 100644 --- a/config.def.h +++ b/config.def.h @@ -126,6 +126,7 @@ static const char *playerprevcmd[] = { "playerctl", "--player=playerctld", "pre static const char *flameshotcmd[] = { "flameshot", "gui", NULL }; #include "movestack.c" +#include "unfloat.c" #include static Key keys[] = { /* modifier key function argument */ @@ -168,9 +169,13 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY|ShiftMask, XK_f, unfloatvisible, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_m, unfloatvisible, {.v = &layouts[2]} }, + // { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, unfloatvisible, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, { MODKEY, XK_Tab, toggleAttachBelow, {0} }, diff --git a/patches/dwm-unfloatvisible-6.2.diff b/patches/dwm-unfloatvisible-6.2.diff new file mode 100644 index 0000000..40c8a3c --- /dev/null +++ b/patches/dwm-unfloatvisible-6.2.diff @@ -0,0 +1,38 @@ +From a972569532c9d46f79776b0f687ebbbd67a6b69f Mon Sep 17 00:00:00 2001 +From: Alexander Courtis +Date: Mon, 22 Apr 2019 22:23:12 +1000 +Subject: [PATCH] unfloat any visible windows which have isfloating set + +optionally takes a layout to also apply + +e.g. +{ MODKEY|ShiftMask, XK_space, unfloatvisible, {0} }, +{ MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[1]} }, +--- + unfloat.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + create mode 100644 unfloat.c + +diff --git a/unfloat.c b/unfloat.c +new file mode 100644 +index 0000000..ef84111 +--- /dev/null ++++ b/unfloat.c +@@ -0,0 +1,14 @@ ++void ++unfloatvisible(const Arg *arg) ++{ ++ Client *c; ++ ++ for (c = selmon->clients; c; c = c->next) ++ if (ISVISIBLE(c) && c->isfloating) ++ c->isfloating = c->isfixed; ++ ++ if (arg && arg->v) ++ setlayout(arg); ++ else ++ arrange(selmon); ++} +-- +2.21.0 + diff --git a/unfloat.c b/unfloat.c new file mode 100644 index 0000000..ef84111 --- /dev/null +++ b/unfloat.c @@ -0,0 +1,14 @@ +void +unfloatvisible(const Arg *arg) +{ + Client *c; + + for (c = selmon->clients; c; c = c->next) + if (ISVISIBLE(c) && c->isfloating) + c->isfloating = c->isfixed; + + if (arg && arg->v) + setlayout(arg); + else + arrange(selmon); +}