Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
barwinwidth patch for dwm 5.9
Make barwin span the whole width of screen, instead of window area.
Basically, replace:
m->ww with m->mw
m->wx with m->mx
This is done so padding the "window area" does not affect barwin.
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2011-08-29 12:00:00.00 +0000
+++ b/dwm.c 2011-08-29 12:00:00.00 +0000
@@ -442,7 +442,7 @@ buttonpress(XEvent *e) {
}
else if(ev->x < x + blw)
click = ClkLtSymbol;
- else if(ev->x > selmon->ww - TEXTW(stext))
+ else if(ev->x > selmon->mw - TEXTW(stext))
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -597,7 +597,7 @@ configurenotify(XEvent *e) {
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
updatebars();
for(m = mons; m; m = m->next)
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
+ XMoveResizeWindow(dpy, m->barwin, m->mx, m->by, m->mw, bh);
arrange(NULL);
}
}
@@ -748,15 +748,15 @@ drawbar(Monitor *m) {
x = dc.x;
if(m == selmon) { /* status is only drawn on selected monitor */
dc.w = TEXTW(stext);
- dc.x = m->ww - dc.w;
+ dc.x = m->mw - dc.w;
if(dc.x < x) {
dc.x = x;
- dc.w = m->ww - x;
+ dc.w = m->mw - x;
}
drawtext(stext, dc.norm, False);
}
else
- dc.x = m->ww;
+ dc.x = m->mw;
if((dc.w = dc.x - x) > bh) {
dc.x = x;
if(m->sel) {
@@ -767,7 +767,7 @@ drawbar(Monitor *m) {
else
drawtext(NULL, dc.norm, False);
}
- XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
+ XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->mw, bh, 0, 0);
XSync(dpy, False);
}
@@ -1131,8 +1131,8 @@ manage(Window w, XWindowAttributes *wa)
c->y = c->mon->my + c->mon->mh - HEIGHT(c);
c->x = MAX(c->x, c->mon->mx);
/* only fix client y-offset, if the client center might cover the bar */
- c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx)
- && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
+ c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->mx)
+ && (c->x + (c->w / 2) < c->mon->mx + c->mon->mw)) ? bh : c->mon->my);
c->bw = borderpx;
}
wc.border_width = c->bw;
@@ -1673,7 +1673,7 @@ void
togglebar(const Arg *arg) {
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->mx, selmon->by, selmon->mw, bh);
arrange(selmon);
}
@@ -1763,7 +1763,7 @@ updatebars(void) {
.event_mask = ButtonPressMask|ExposureMask
};
for(m = mons; m; m = m->next) {
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
+ m->barwin = XCreateWindow(dpy, root, m->mx, m->by, m->mw, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
windowarea_margin patch for dwm 5.9
Introduce margin around the "window area", to eliminate "double gaps" between
client windows by doubling it on the window area edges too.
m->gap is the gap in pixel around window area and client windows.
The default value of this gap should be defined in config.h:
static const unsigned int gappx = 3;
Note that due to "double gaps", the gaps you see are the double size of gappx.
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2011-08-29 12:00:00.00 +0000
+++ b/dwm.c 2011-08-29 12:00:00.00 +0000
@@ -125,6 +125,7 @@ typedef struct {
struct Monitor {
char ltsymbol[16];
float mfact;
+ int gap;
int num;
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
@@ -1773,12 +1774,16 @@ updatebars(void) {
void
updatebarpos(Monitor *m) {
- m->wy = m->my;
- m->wh = m->mh;
+ m->wy = m->my + m->gap;
+ m->wh = m->mh - m->gap * 2;
if(m->showbar) {
m->wh -= bh;
- m->by = m->topbar ? m->wy : m->wy + m->wh;
- m->wy = m->topbar ? m->wy + bh : m->wy;
+ if(m->topbar) {
+ m->by = m->my;
+ m->wy += bh;
+ }
+ else
+ m->by = m->wy + m->wh + m->gap;
}
else
m->by = -bh;
@@ -1819,12 +1824,15 @@ updategeom(void) {
|| unique[i].width != m->mw || unique[i].height != m->mh))
{
dirty = True;
+ m->gap = gappx;
m->num = i;
m->mx = m->wx = unique[i].x_org;
m->my = m->wy = unique[i].y_org;
m->mw = m->ww = unique[i].width;
m->mh = m->wh = unique[i].height;
updatebarpos(m);
+ m->wx += m->gap;
+ m->ww -= m->gap * 2;
}
}
else { /* less monitors available nn < n */
@@ -1854,9 +1862,12 @@ updategeom(void) {
mons = createmon();
if(mons->mw != sw || mons->mh != sh) {
dirty = True;
+ mons->gap = gappx;
mons->mw = mons->ww = sw;
mons->mh = mons->wh = sh;
updatebarpos(mons);
+ mons->wx += mons->gap;
+ mons->ww -= mons->gap * 2;
}
}
if(dirty) {
resizeclient_margin patch for dwm 5.9
This is a.k.a. the uselessgap patch. It's the core part of the gaps patches.
This patch adds margins around client windows except for special layouts and
floating windows. The margins, or gaps, can be seen as transparent borders.
Just like borders, margins are not part of the window dimension, and adjacent
margins of two adjacent windows don't collapse, but form a "double gap".
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2011-08-29 12:00:00.00 +0000
+++ b/dwm.c 2011-08-29 12:00:00.00 +0000
@@ -1317,11 +1317,21 @@ resize(Client *c, int x, int y, int w, i
void
resizeclient(Client *c, int x, int y, int w, int h) {
XWindowChanges wc;
+ Monitor *m = c->mon;
+ int gap;
- c->oldx = c->x; c->x = wc.x = x;
- c->oldy = c->y; c->y = wc.y = y;
- c->oldw = c->w; c->w = wc.width = w;
- c->oldh = c->h; c->h = wc.height = h;
+ /* make movemouse() and resizemouse() happy */
+ if(c->isfloating || c->isfullscreen || !m->lt[m->sellt]->arrange)
+ gap = 0;
+ /* hide borders in monocle layout */
+ else if(m->lt[m->sellt]->arrange == monocle)
+ gap = -c->bw;
+ else
+ gap = m->gap;
+ c->oldx = c->x; c->x = wc.x = x + gap;
+ c->oldy = c->y; c->y = wc.y = y + gap;
+ c->oldw = c->w; c->w = wc.width = w - gap * 2;
+ c->oldh = c->h; c->h = wc.height = h - gap * 2;
wc.border_width = c->bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
layout_margin patch for dwm 5.9
This patch adjusts the default layouts to work well with the gaps patches.
The monocle layout is a special case handled both here and in the
resizeclient_margin patch. The result is in monocle layout, client windows
get expanded to cover the gap around "window area", mimicing negative margins
in CSS. The other patch also hides the window borders using the same technique.
The tile layout, like any other tiling layout, should make sure that the
"double gaps" effect is always present. The same adjustments are done for the
bstack layout too.
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2011-08-29 12:00:00.00 +0000
+++ b/dwm.c 2011-08-29 12:00:00.00 +0000
@@ -1187,8 +1187,8 @@ monocle(Monitor *m) {
n++;
if(n > 0) /* 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, False);
+ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) /* No gap for monocle */
+ resize(c, m->wx - m->gap, m->wy - m->gap, m->ww + m->gap * 2, m->wh + m->gap * 2, False);
}
void
@@ -1655,7 +1655,7 @@ tile(Monitor *m) {
if(--n == 0)
return;
/* tile stack */
- x = (m->wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : m->wx + mw;
+ x = (m->wx + mw > c->x + c->w) ? c->x + c->w + m->gap + 2 * c->bw : m->wx + mw;
y = m->wy;
w = (m->wx + mw > c->x + c->w) ? m->wx + m->ww - x : m->ww - mw;
h = m->wh / n;
@@ -1665,7 +1665,7 @@ tile(Monitor *m) {
resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False);
if(h != m->wh)
- y = c->y + HEIGHT(c);
+ y = c->y + HEIGHT(c) + m->gap;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.