From 07279cd4d3246c5cae38d9f323bf7e9baf693f59 Mon Sep 17 00:00:00 2001 From: sheldonmlee Date: Sun, 23 May 2021 14:00:10 +0800 Subject: [PATCH] Added toggle layout functionality. --- dwm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dwm.c b/dwm.c index b980f44..4cb0b88 100644 --- a/dwm.c +++ b/dwm.c @@ -237,6 +237,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); static void centeredmaster(Monitor *m); static void centeredfloatingmaster(Monitor *m); +static void togglelayout(const Arg *arg); /* variables */ static const char broken[] = "broken"; @@ -2263,3 +2264,15 @@ centeredfloatingmaster(Monitor *m) tx += WIDTH(c); } } + +void +togglelayout(const Arg* arg) +{ + int on; + if (!arg) return; + Layout* to = (Layout*)arg->v; + on = to->arrange == selmon->lt[selmon->sellt]->arrange; // check if arrange function is the same + if (!on) setlayout(arg); + else setlayout(NULL); +} +