X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=dwm.c;h=096895c4617019542c64886f0d25a8c659e84f49;hb=64674c395b89f8d9640163cdcf9c8f4e25ba0e9c;hp=26ec20b34f90cf2b67bb2d0e030c793b461c0024;hpb=a73ff905b04a5f1dab6e0aface03317a81528a95;p=dwm.git diff --git a/dwm.c b/dwm.c index 26ec20b..096895c 100644 --- a/dwm.c +++ b/dwm.c @@ -804,13 +804,11 @@ focusmon(const Arg *arg) { for(i = 0, m = mons; m; m = m->next, i++) if(i == arg->ui) { - if(m->stack) - focus(m->stack); - else { - unfocus(selmon->stack); - selmon = m; - focus(NULL); - } + if(m == selmon) + return; + unfocus(selmon->sel); + selmon = m; + focus(NULL); drawbars(); break; } @@ -1502,12 +1500,10 @@ tagmon(const Arg *arg) { detach(c); detachstack(c); c->mon = m; - c->tags = m->seltags; /* assign tags of target monitor */ + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ attach(c); attachstack(c); - m->sel = c; - for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); - selmon->sel = c; + focus(NULL); arrange(); break; }