sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit b40f5430a3504a24823655a8e261ef899883766f
parent a9e7c87857b8bd09dd95e46c5991fe6855d6e426
Author: Eric Pruitt <eric.pruitt@gmail.com>
Date:   Sun, 27 Dec 2015 14:03:18 -0800

Rewrite of better-borders patch

Diffstat:
Mdwm.suckless.org/patches/better-borders.md | 5++++-
Mdwm.suckless.org/patches/dwm-6.1-better-borders.diff | 119++++++++++++++++++++++++++++++++++++-------------------------------------------
2 files changed, 58 insertions(+), 66 deletions(-)

diff --git a/dwm.suckless.org/patches/better-borders.md b/dwm.suckless.org/patches/better-borders.md @@ -12,10 +12,13 @@ as the monitor and marks them full-screen even if their X properties indicate otherwise. This eliminates nuisance borders that appear with some games and applications while in full-screen mode. +Thanks to Alesandar Metodiev for reporting a bug that lead to the patch being +rewritten. + Download -------- - * [dwm-6.1-better-borders.diff](dwm-6.1-better-borders.diff) (2014-07-13) + * [dwm-6.1-better-borders.diff](dwm-6.1-better-borders.diff) (2015-12-27) Author ------ diff --git a/dwm.suckless.org/patches/dwm-6.1-better-borders.diff b/dwm.suckless.org/patches/dwm-6.1-better-borders.diff @@ -1,77 +1,66 @@ +Author: Eric Pruitt, https://github.com/ericpruitt/ +Description: This patch makes dwm remove borders when only one, non-floating +window is visible. Additionally, any windows that are the same size as the +monitor are considered full-screen and their borders removed accordingly. + diff --git a/dwm.c b/dwm.c -index 0362114..5c40060 100644 +index 0362114..03fddb6 100644 --- a/dwm.c +++ b/dwm.c -@@ -310,6 +310,34 @@ applyrules(Client *c) - c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; - } - -+void -+adjustborders(Monitor *m) { -+ Client *c, *l = NULL; -+ int visible = 0; -+ -+ for(c = m->clients; c; c = c->next) { -+ if (ISVISIBLE(c) && !c->isfloating && m->lt[m->sellt]->arrange) { -+ if (m->lt[m->sellt]->arrange == monocle) { -+ visible = 1; -+ c->oldbw = c->bw; -+ c->bw = 0; -+ } else { -+ visible++; -+ c->oldbw = c->bw; +@@ -393,9 +393,24 @@ arrange(Monitor *m) + void + arrangemon(Monitor *m) + { ++ int n = 0; ++ Client *c; + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); +- if (m->lt[m->sellt]->arrange) +- m->lt[m->sellt]->arrange(m); ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n > 1 || !m->lt[m->sellt]->arrange) { ++ for (c = m->clients; c; c = c->next) { ++ if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) { ++ c->oldbw = c->oldbw; + c->bw = borderpx; ++ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw)); + } -+ -+ l = c; + } ++ if (m->lt[m->sellt]->arrange) { ++ m->lt[m->sellt]->arrange(m); ++ } ++ } else { ++ monocle(m); + } -+ -+ if (l && visible == 1 && l->bw) { -+ l->oldbw = l->bw; -+ l->bw = 0; -+ resizeclient(l, l->x, l->y, l->w, l->h); -+ } -+} -+ - int - applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) - { -@@ -379,10 +407,13 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) + } + void - arrange(Monitor *m) +@@ -1117,16 +1132,25 @@ maprequest(XEvent *e) + void + monocle(Monitor *m) { -- if (m) -+ if (m) { -+ adjustborders(m); - showhide(m->stack); -- else for (m = mons; m; m = m->next) -+ } else for (m = mons; m; m = m->next) { -+ adjustborders(m); - showhide(m->stack); -+ } - if (m) { - arrangemon(m); - restack(m); -@@ -1061,7 +1092,20 @@ manage(Window w, XWindowAttributes *wa) - /* only fix client y-offset, if the client center might cover the bar */ - c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) - && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); -- c->bw = borderpx; -+ -+ updatewindowtype(c); -+ if (c->isfloating) { -+ c->bw = c->isfullscreen ? 0 : borderpx; -+ } else { -+ c->bw = 0; -+ for(t = c->mon->clients; t; t = c->next) { -+ if (!t->isfloating && c != t && c->tags & t->tags) { -+ c->bw = borderpx; -+ break; -+ } +- unsigned int n = 0; ++ unsigned int n = 0, r = 0; + Client *c; + + for (c = m->clients; c; c = c->next) + if (ISVISIBLE(c)) + n++; +- if (n > 0) /* override layout symbol */ ++ if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */ + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); +- for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) +- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); ++ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) { ++ if (c->bw) { ++ c->oldbw = c->bw; ++ c->bw = 0; ++ r = 1; ++ } ++ resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False); ++ if(r) { ++ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw)); + } -+ adjustborders(c->mon); + } + } - wc.border_width = c->bw; - XConfigureWindow(dpy, w, CWBorderWidth, &wc); + void