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