make window follow patch monitor independent

This commit is contained in:
Jakub 2024-05-16 23:26:11 -04:00
parent ae22b05118
commit 4f9dcc5d42

18
dwm.c
View File

@ -126,7 +126,6 @@ typedef struct {
typedef struct Pertag Pertag;
struct Monitor {
char ltsymbol[16];
char wfsymbol[2];
float mfact;
int nmaster;
int num;
@ -285,6 +284,7 @@ static const char broken[] = "broken";
static char stext[256];
static char estextl[256];
static char estextr[256];
static char wfsymbol[2];
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh; /* bar height */
@ -564,7 +564,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < (x = (x + TEXTW(selmon->ltsymbol))))
click = ClkLtSymbol;
else if (ev->x < x + TEXTW(selmon->wfsymbol))
else if (ev->x < x + TEXTW(wfsymbol))
click = ClkFollowSymbol;
/* 2px right padding */
else if (ev->x > selmon->ww - TEXTW(stext) + lrpad - 2)
@ -803,8 +803,8 @@ createmon(void)
m->pertag->showbars[i] = m->showbar;
}
m->wfsymbol[0] = WFDEFAULT;
m->wfsymbol[1] = '\0';
wfsymbol[0] = WFDEFAULT;
wfsymbol[1] = '\0';
return m;
}
@ -898,8 +898,8 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
w = TEXTW(m->wfsymbol);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->wfsymbol, 0);
w = TEXTW(wfsymbol);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, wfsymbol, 0);
if ((w = m->ww - tw - x) > bh) {
if (n > 0) {
@ -2163,7 +2163,7 @@ tag(const Arg *arg)
focus(NULL);
arrange(selmon);
}
if (selmon->wfsymbol[0] == WFACTIVE)
if (wfsymbol[0] == WFACTIVE)
view(arg);
}
@ -2173,7 +2173,7 @@ tagmon(const Arg *arg)
if (!selmon->sel || !mons->next)
return;
sendmon(selmon->sel, dirtomon(arg->i));
if (selmon->wfsymbol[0] == WFACTIVE)
if (wfsymbol[0] == WFACTIVE)
focusmon(arg);
}
@ -2235,7 +2235,7 @@ toggleextrabar(const Arg *arg)
void
togglefollow(const Arg *arg)
{
selmon->wfsymbol[0] = (selmon->wfsymbol[0] == WFACTIVE) ? WFINACTIVE : WFACTIVE;
wfsymbol[0] = (wfsymbol[0] == WFACTIVE) ? WFINACTIVE : WFACTIVE;
drawbars();
}