From 31aef05d160eb20228919461a6e3a03670c09b0a Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Mon, 10 Jan 2022 13:16:52 +0100 Subject: [PATCH 2/2] togglelayout - keyboard shortcuts to set a given layout will toggle to the previous layout if the given layout is already active --- dwm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dwm.c b/dwm.c index b8ae4a5..c4b3166 100644 --- a/dwm.c +++ b/dwm.c @@ -1542,11 +1542,9 @@ setfullscreen(Client *c, int fullscreen) void setlayout(const Arg *arg) { - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) { - selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; - selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; - } - if (arg && arg->v) + selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; + selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; + if (arg && arg->v && arg->v != selmon->lt[selmon->sellt ^ 1]) selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); -- 2.19.1