diff --git a/dwm.c b/dwm.c index fb5f2e9..a9dbfb6 100644 --- a/dwm.c +++ b/dwm.c @@ -1788,15 +1788,27 @@ setfullscreen(Client *c, int fullscreen) void setlayout(const Arg *arg) { - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) + if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) { selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; - if (arg && arg->v) - selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; - strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); - if (selmon->sel) + } + + if (arg && arg->v) { + const Layout *const new_layout = arg->v; + selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = new_layout; + selmon->lt[selmon->sellt] = new_layout; + } + + strncpy( + selmon->ltsymbol, + selmon->lt[selmon->sellt]->symbol, + sizeof(selmon->ltsymbol) + ); + + if (selmon->sel) { arrange(selmon); - else + } else { drawbar(selmon); + } } /* arg > 1.0 will set mfact absolutely */