[wiki] [sites] Added better-borders patch || Eric Pruitt

From: <git_AT_suckless.org>
Date: Mon, 14 Jul 2014 02:16:22 +0200

commit 63ca06da65af0063b7c9e49a191e07d5de9f8ac8
Author: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Sun Jul 13 19:15:45 2014 -0500

    Added better-borders patch
    
    - Better-borders patch hides borders when only one window is shown and
      ensures monitor-sized windows are borderless.

diff --git a/dwm.suckless.org/patches/better-borders.md b/dwm.suckless.org/patches/better-borders.md
new file mode 100644
index 0000000..4009a9b
--- /dev/null
+++ b/dwm.suckless.org/patches/better-borders.md
_AT_@ -0,0 +1,22 @@
+better borders
+==============
+
+Description
+-----------
+
+Like [Ebersbach's patch](http://dwm.suckless.org/patches/noborder), this patch
+removes the border when there is only one window visible, but this patch does
+not depend on layout-specific changes and should automatically work with most
+layouts. The patch also removes borders from any windows that are the same size
+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.
+
+Download
+--------
+
+ * [dwm-6.1-better-borders.diff](dwm-6.1-better-borders.diff) (2014-07-13)
+
+Author
+------
+ * Eric Pruitt - `<eric dot pruitt at gmail dot com>`
diff --git a/dwm.suckless.org/patches/dwm-6.1-better-borders.diff b/dwm.suckless.org/patches/dwm-6.1-better-borders.diff
new file mode 100644
index 0000000..1ef049f
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.1-better-borders.diff
_AT_@ -0,0 +1,92 @@
+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 ffc8864..3ce8ebe 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -308,6 +308,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;
++ c->bw = borderpx;
++ }
++
++ l = c;
++ }
++ }
++
++ if (l && visible == 1 && l->bw) {
++ l->oldbw = l->bw;
++ l->bw = 0;
++ resizeclient(l, l->x, l->y, l->w, l->h);
++ }
++}
++
+ Bool
+ applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact) {
+ Bool baseismin;
+_AT_@ -376,10 +404,13 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact) {
+
+ void
+ arrange(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);
+_AT_@ -1036,7 +1067,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;
++ }
++ }
++ adjustborders(c->mon);
++ }
+
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+_AT_@ -1933,7 +1977,8 @@ updatewindowtype(Client *c) {
+ Atom state = getatomprop(c, netatom[NetWMState]);
+ Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
+
+- if(state == netatom[NetWMFullscreen])
++ if(state == netatom[NetWMFullscreen] ||
++ (WIDTH(c) == (c->mon->mx + c->mon->mw) && (HEIGHT(c) == (c->mon->my + c->mon->mh))))
+ setfullscreen(c, True);
+ if(wtype == netatom[NetWMWindowTypeDialog])
+ c->isfloating = True;
diff --git a/dwm.suckless.org/patches/noborder.md b/dwm.suckless.org/patches/noborder.md
index 29c38ca..57359a5 100644
--- a/dwm.suckless.org/patches/noborder.md
+++ b/dwm.suckless.org/patches/noborder.md
_AT_@ -5,6 +5,9 @@ Description
 -----------
 This patch removes the border when there is just one window visible in tiled or monocle layout.
 
+For an alternative that works with most layouts without any layout-specific
+changes, check out [better borders](http://dwm.suckless.org/patches/better-borders).
+
 Download
 --------
 Patches against different versions of dwm are available at
Received on Mon Jul 14 2014 - 02:16:22 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:39:25 CEST