diff options
-rw-r--r-- | config.h | 6 | ||||
-rw-r--r-- | dwm.c | 29 | ||||
-rw-r--r-- | vanitygaps.c | 57 |
3 files changed, 48 insertions, 44 deletions
@@ -57,15 +57,15 @@ static const int mainmon = 0; /* xsetroot will only change the bar on this monit /* Devide dependent configurations */ #ifdef _HOST_BATTLESTATION // Main desktop uses a 4k monitor (good to have a bigger font) - static const char *fonts[] = { "monospace:size=18" }; + static const char *fonts[] = { "monospace:size=16" }; /* LayoutPerMonitor: 4k->tile, ultrawide->tilewide */ - static const int lpm[] = { 0, 0 }; + static const int lpm[] = { 0, 4 }; /* Gaps are nice on a big monitor */ static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ #else // _HOST_DEFAULT // Smaller font for laptop form factor - static const char *fonts[] = { "monospace:size=16" }; // HiDPI Framework laptop + static const char *fonts[] = { "monospace:size=14" }; // HiDPI Framework laptop /* LayoutPerMonitor: main->tile */ static const int lpm[] = { 0 }; /* Gaps are nice on a big monitor */ @@ -227,7 +227,6 @@ static void showhide(Client *c); static void sigstatusbar(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); -static void tilewide(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -1942,34 +1941,6 @@ tagmon(const Arg *arg) } void -tilewide(Monitor *m) -{ - unsigned int i, n, w, h, mw, mx, ty; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - - if (n > m->nmaster) - mw = m->nmaster ? m->ww * m->mfact : 0; - else - mw = m->ww; - for (i = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - w = (mw - mx) / (MIN(n, m->nmaster) - i); - resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0); - if (mx + WIDTH(c) < m->ww) - mx += WIDTH(c); - } else { - h = (m->wh - ty) / (n - i); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); - if (ty + HEIGHT(c) < m->wh) - ty += HEIGHT(c); - } -} - -void togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; diff --git a/vanitygaps.c b/vanitygaps.c index 37867eb..a214e4c 100644 --- a/vanitygaps.c +++ b/vanitygaps.c @@ -8,6 +8,7 @@ static void incrovgaps(const Arg *arg); static void incrihgaps(const Arg *arg); static void incrivgaps(const Arg *arg); static void togglegaps(const Arg *arg); +static void tilewide(Monitor *m); /* Layouts (delete the ones you do not need) */ static void bstackhoriz(Monitor *m); static void centeredmaster(Monitor *m); @@ -16,11 +17,7 @@ static void tile(Monitor *m); static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc); static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr); static void setgaps(int oh, int ov, int ih, int iv); - -/* Settings */ -#if !PERTAG_PATCH static int enablegaps = 1; -#endif // PERTAG_PATCH void setgaps(int oh, int ov, int ih, int iv) @@ -40,11 +37,7 @@ setgaps(int oh, int ov, int ih, int iv) void togglegaps(const Arg *arg) { - #if PERTAG_PATCH - selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag]; - #else enablegaps = !enablegaps; - #endif // PERTAG_PATCH arrange(NULL); } @@ -135,11 +128,7 @@ void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) { unsigned int n, oe, ie; - #if PERTAG_PATCH - oe = ie = selmon->pertag->enablegaps[selmon->pertag->curtag]; - #else oe = ie = enablegaps; - #endif // PERTAG_PATCH Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); @@ -409,3 +398,47 @@ tile(Monitor *m) sy += HEIGHT(c) + ih; } } + + +void +tilewide(Monitor *m) +{ + unsigned int i, n; + int oh, ov, ih, iv; + int mx = 0, my = 0, fullmw = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + float mfacts, stacts; + int mrest, srest; + Client *c; + + getgaps(m, &oh, &ov, &ih, &iv, &n); + + if (n == 0) + return; + + sx = mx = m->wx + ov; + sy = my = m->wy + oh; + mh = m->wh - 2*oh; // Since master tiles horizontally + sh = m->wh - 2*oh - ih * (n - m->nmaster - 1); + fullmw = ((m->ww - 2*ov) * m->mfact); + sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1); + + if (m->nmaster && n > m->nmaster) { + mw = fullmw - iv*(m->nmaster-1); + sx = mx + fullmw+iv; + sw = (m->ww - 2*ov) * (1-m->mfact); + } + + getfacts(m, mw, sw, &mfacts, &stacts, &mrest, &srest); + + for (i=0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c) + iv; + } else { + resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / stacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0); + sy += HEIGHT(c) + ih; + } + } + +} |