From 1cca39d31ca5cafe47545a5759e2a4be23f47eb0 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 30 May 2021 13:52:29 +0200 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 466177c..df25a2d 100644 --- a/dwm.c +++ b/dwm.c @@ -1538,11 +1538,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