fix tabbed monocle errors

This commit is contained in:
Bryson Steck 2022-11-04 09:41:38 -06:00
parent 12da4da048
commit 7b657cf04d
2 changed files with 3 additions and 80 deletions

View file

@ -89,6 +89,7 @@ static const char *slock[] = { "slock", NULL };
static const char *playpause[] = { "playerctl", "play-pause", NULL };
static const char *next[] = { "f9.sh", NULL };
static const char *previous[] = { "playerctl", "previous", NULL };
static const char *keepass[] = { "keepassxc", NULL };
static Key keys[] = {
/* modifier key function argument */
@ -130,6 +131,7 @@ static Key keys[] = {
{ MODKEY, XK_F7, spawn, {.v = previous } },
{ MODKEY, XK_F8, spawn, {.v = playpause } },
{ MODKEY, XK_F9, spawn, {.v = next } },
{ MODKEY|ShiftMask, XK_k, spawn, {.v = keepass } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)

81
dwm.c
View file

@ -128,7 +128,6 @@ struct Monitor {
unsigned int sellt;
unsigned int tagset[2];
int showbar;
int showtab;
int topbar;
int toptab;
Client *clients;
@ -182,7 +181,6 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static void focuswin(const Arg* arg);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
@ -222,7 +220,6 @@ static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tabmode(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
@ -250,8 +247,6 @@ static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);
/* variables */
static const char broken[] = "broken";
@ -686,7 +681,6 @@ createmon(void)
m->mfact = mfact;
m->nmaster = nmaster;
m->showbar = showbar;
m->showtab = showtab;
m->topbar = topbar;
m->gappx = gappx;
m->lt[0] = &layouts[0];
@ -1905,17 +1899,6 @@ togglebar(const Arg *arg)
arrange(selmon);
}
void
tabmode(const Arg *arg)
{
if(arg && arg->i >= 0)
selmon->showtab = arg->ui % showtab_nmodes;
else
selmon->showtab = (selmon->showtab + 1 ) % showtab_nmodes;
arrange(selmon);
}
void
togglefloating(const Arg *arg)
{
@ -2057,8 +2040,7 @@ updatebarpos(Monitor *m)
if(ISVISIBLE(c)) ++nvis;
}
if(m->showtab == showtab_always
|| ((m->showtab == showtab_auto) && (nvis > 1) && (m->lt[m->sellt]->arrange == monocle))) {
if((nvis > 1) && (m->lt[m->sellt]->arrange == monocle)) {
m->wh -= th;
m->ty = m->toptab ? m->wy : m->wy + m->wh;
if ( m->toptab )
@ -2384,64 +2366,3 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
static void
bstack(Monitor *m) {
int w, h, mh, mx, tx, ty, tw;
unsigned int i, n;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
if (n > m->nmaster) {
mh = m->nmaster ? m->mfact * m->wh : 0;
tw = m->ww / (n - m->nmaster);
ty = m->wy + mh;
} else {
mh = m->wh;
tw = m->ww;
ty = m->wy;
}
for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
if (i < m->nmaster) {
w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
mx += WIDTH(c);
} else {
h = m->wh - mh;
resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
if (tw != m->ww)
tx += WIDTH(c);
}
}
}
static void
bstackhoriz(Monitor *m) {
int w, mh, mx, tx, ty, th;
unsigned int i, n;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
if (n > m->nmaster) {
mh = m->nmaster ? m->mfact * m->wh : 0;
th = (m->wh - mh) / (n - m->nmaster);
ty = m->wy + mh;
} else {
th = mh = m->wh;
ty = m->wy;
}
for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
if (i < m->nmaster) {
w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
mx += WIDTH(c);
} else {
resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
if (th != m->wh)
ty += HEIGHT(c);
}
}
}