chore: some mw updates again

This commit is contained in:
Arthur Khachaturov 2024-09-19 04:25:52 +03:00
parent 448eee179a
commit 9acd06d85a
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55

21
dwm.c
View file

@ -95,7 +95,7 @@ typedef struct Client Client;
struct Client { struct Client {
char name[256]; char name[256];
float mina, maxa; float mina, maxa;
int mwpin; int is_mwpinned;
float cfact; float cfact;
int x, y, w, h; int x, y, w, h;
int oldx, oldy, oldw, oldh; int oldx, oldy, oldw, oldh;
@ -358,7 +358,7 @@ applyrules(Client *c)
for (m = mons; m && m->num != r->monitor; m = m->next); for (m = mons; m && m->num != r->monitor; m = m->next);
if (m) if (m)
c->mon = m; c->mon = m;
c->mwpin = r->mwpin; c->is_mwpinned = r->mwpin;
} }
} }
if (ch.res_class) if (ch.res_class)
@ -1415,7 +1415,7 @@ pinmetaws(const Arg *_)
if (!selmon || !selmon->sel) if (!selmon || !selmon->sel)
return; return;
c->mwpin = !c->mwpin; c->is_mwpinned = !c->is_mwpinned;
for(i = 0; i < LENGTH(metaworkspaces); ++i) for(i = 0; i < LENGTH(metaworkspaces); ++i)
c->tags[i] = c->tags[metaws]; c->tags[i] = c->tags[metaws];
} }
@ -1637,9 +1637,13 @@ scan(void)
void void
sendmon(Client *c, Monitor *m) sendmon(Client *c, Monitor *m)
{ {
if (c->mon == m || c->mwpin) int i = 0;
if (c->mon == m )
return; return;
if (c->is_mwpinned)
c->is_mwpinned = 0;
unfocus(c, 1); unfocus(c, 1);
detach(c); detach(c);
detachstack(c); detachstack(c);
@ -1647,6 +1651,7 @@ sendmon(Client *c, Monitor *m)
Client *pc = selmon->stack; Client *pc = selmon->stack;
c->mon = m; c->mon = m;
for (; i < LENGTH(metaworkspaces); ++i) c->tags[i] = 0;
c->tags[metaws] = m->tagset[metaws][m->seltags[metaws]]; /* assign tags of target monitor */ c->tags[metaws] = m->tagset[metaws][m->seltags[metaws]]; /* assign tags of target monitor */
if (m->spawnmaster) if (m->spawnmaster)
@ -1946,7 +1951,7 @@ tag(const Arg *arg)
int i; int i;
Client *c = selmon->sel; Client *c = selmon->sel;
if (c && arg->ui & TAGMASK) { if (c && arg->ui & TAGMASK) {
if (!c->mwpin) if (!c->is_mwpinned)
c->tags[metaws] = arg->ui & TAGMASK; c->tags[metaws] = arg->ui & TAGMASK;
else for(i = 0; i < LENGTH(metaworkspaces); ++i) else for(i = 0; i < LENGTH(metaworkspaces); ++i)
c->tags[i] = arg->ui & TAGMASK; c->tags[i] = arg->ui & TAGMASK;
@ -1964,12 +1969,12 @@ tagmetaws(const Arg *arg)
return; return;
if (arg->i == -1) { if (arg->i == -1) {
selmon->sel->mwpin = 1; selmon->sel->is_mwpinned = 1;
for (i = 0; i < LENGTH(metaworkspaces); ++i) for (i = 0; i < LENGTH(metaworkspaces); ++i)
selmon->sel->tags[i] = selmon->sel->tags[metaws]; selmon->sel->tags[i] = selmon->sel->tags[metaws];
} }
else { else {
selmon->sel->mwpin = 0; selmon->sel->is_mwpinned = 0;
for (i = 0; i < LENGTH(metaworkspaces); ++i) for (i = 0; i < LENGTH(metaworkspaces); ++i)
selmon->sel->tags[i] = 0; selmon->sel->tags[i] = 0;
selmon->sel->tags[arg->i] = selmon->tagset[arg->i][selmon->seltags[arg->i]]; selmon->sel->tags[arg->i] = selmon->tagset[arg->i][selmon->seltags[arg->i]];
@ -2055,7 +2060,7 @@ toggletag(const Arg *arg)
return; return;
newtags = selmon->sel->tags[metaws] ^ (arg->ui & TAGMASK); newtags = selmon->sel->tags[metaws] ^ (arg->ui & TAGMASK);
if (newtags) { if (newtags) {
if (!selmon->sel->mwpin) if (!selmon->sel->is_mwpinned)
selmon->sel->tags[metaws] = newtags; selmon->sel->tags[metaws] = newtags;
else for(i = 0; i < LENGTH(metaworkspaces); ++i) else for(i = 0; i < LENGTH(metaworkspaces); ++i)
selmon->sel->tags[i] = newtags; selmon->sel->tags[i] = newtags;