commit 5a7c1ef887a09cc19b9a435c7bcf255b0a319b75
parent 88d7fe12902b83257e6ed3e181672f2669e3c37a
Author: Miles Alan <m@milesalan.com>
Date: Sat, 25 Apr 2020 18:02:12 -0500
Toggle floating and unfloat visible
Diffstat:
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -119,6 +119,8 @@ static Key keys[] = {
{ 0, MODKEY, XK_slash, setlayout, {.v = &layouts[0]} },
{ 0, MODKEY|ShiftMask, XK_slash, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, togglefloating, {0} },
+ { MODKEY|ShiftMask, XK_f, unfloatvisible, {0} },
{ 0, MODKEY, XK_space, setlayout, {0} },
{ 0, MODKEY|ShiftMask, XK_space, togglefloating, {0} },
diff --git a/dwm.c b/dwm.c
@@ -229,6 +229,7 @@ static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
+static void unfloatvisible(const Arg *arg);
static void unfocus(Client *c, int setfocus);
static void unmanage(Client *c, int destroyed);
static void unmapnotify(XEvent *e);
@@ -2801,3 +2802,18 @@ shiftview(const Arg *arg) {
view(&shifted);
}
+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);
+}
+