diff --git a/PATCHES b/PATCHES index c8820b7..84b7f2f 100644 --- a/PATCHES +++ b/PATCHES @@ -3,5 +3,7 @@ quitprompt fullgaps gaplessgrid status2d + extrabar +barpadding + notitle anycorners +fonts? diff --git a/config.def.h b/config.def.h index f14efef..e28ecff 100644 --- a/config.def.h +++ b/config.def.h @@ -153,7 +153,6 @@ static const Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, SUPERKEY, Button1, movemouse, {0} }, { ClkClientWin, SUPERKEY, Button2, togglefloating, {0} }, diff --git a/config.h b/config.h index f14efef..e28ecff 100644 --- a/config.h +++ b/config.h @@ -153,7 +153,6 @@ static const Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, SUPERKEY, Button1, movemouse, {0} }, { ClkClientWin, SUPERKEY, Button2, togglefloating, {0} }, diff --git a/dwm b/dwm index 4759992..56b52e5 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index a7d4e26..5cf65b6 100644 --- a/dwm.c +++ b/dwm.c @@ -64,7 +64,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ -enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, +enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ typedef union { @@ -120,7 +120,6 @@ struct Monitor { int eby; /* extra bar geometry */ int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ - int gappx; /* gaps between windows */ unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; @@ -247,7 +246,7 @@ static int sw, sh; /* X display screen geometry width, height */ static int bh; /* bar height */ static int lrpad; /* sum of left and right padding for text */ static int (*xerrorxlib)(Display *, XErrorEvent *); -static unsigned int numlockmask = 0; +static unsigned int numlockmask = 1; static void (*handler[LASTEvent]) (XEvent *) = { [ButtonPress] = buttonpress, [ClientMessage] = clientmessage, @@ -447,10 +446,8 @@ buttonpress(XEvent *e) arg.ui = 1 << i; } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; - else if (ev->x > selmon->ww - (int)TEXTW(stext)) - click = ClkStatusText; else - click = ClkWinTitle; + click = ClkStatusText; } else if ((c = wintoclient(ev->window))) { focus(c); restack(selmon); @@ -578,8 +575,8 @@ configurenotify(XEvent *e) for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); - XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh); + XMoveResizeWindow(dpy, m->barwin, m->wx + gappx, m->by + gappx, m->ww - 2 * gappx, bh); + XMoveResizeWindow(dpy, m->extrabarwin, m->wx + gappx, m->eby - gappx, m->ww - 2 * gappx, bh); } focus(NULL); arrange(NULL); @@ -650,7 +647,6 @@ createmon(void) m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; - m->gappx = gappx; m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); @@ -744,11 +740,11 @@ drawstatusbar(Monitor *m, int bh, int extra, char* stext) { text = p; if (extra) { - w = m->ww; - ret = x = 1; + w = m->ww - 2 * gappx; + ret = x = 0; } else { - w += 2; /* 1px padding on both sides */ - ret = x = m->ww - w; + ret = m->ww - w; + x = ret - 2 * gappx; } drw_setscheme(drw, scheme[LENGTH(colors)]); @@ -859,15 +855,8 @@ drawbar(Monitor *m) x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); if ((w = m->ww - tw - x) > bh) { - if (m->sel) { - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); - if (m->sel->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); - } else { - drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); - } + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x, 0, w - 2 * gappx, bh, 1, 1); } drw_map(drw, m->barwin, 0, 0, m->ww, bh); @@ -1359,11 +1348,8 @@ propertynotify(XEvent *e) drawbars(); break; } - if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { + if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) updatetitle(c); - if (c == c->mon->sel) - drawbar(c->mon); - } if (ev->atom == netatom[NetWMWindowType]) updatewindowtype(c); } @@ -1829,8 +1815,8 @@ togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; updatebarpos(selmon); - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); - XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx, selmon->eby, selmon->ww, bh); + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + gappx, selmon->by + gappx, selmon->ww - 2 * gappx, bh); + XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + gappx, selmon->eby - gappx, selmon->ww - 2 * gappx, bh); arrange(selmon); } @@ -1947,7 +1933,7 @@ updatebars(void) XClassHint ch = {"dwm", "dwm"}; for (m = mons; m; m = m->next) { if (!m->barwin) { - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), + m->barwin = XCreateWindow(dpy, root, m->wx + gappx, m->by + gappx, m->ww - 2 * gappx, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); @@ -1955,7 +1941,7 @@ updatebars(void) XSetClassHint(dpy, m->barwin, &ch); } if (!m->extrabarwin) { - m->extrabarwin = XCreateWindow(dpy, root, m->wx, m->eby, m->ww, bh, 0, DefaultDepth(dpy, screen), + m->extrabarwin = XCreateWindow(dpy, root, m->wx + gappx, m->eby - gappx, m->ww - 2 * gappx, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XDefineCursor(dpy, m->extrabarwin, cursor[CurNormal]->cursor); @@ -1979,13 +1965,15 @@ updatebarpos(Monitor *m) m->wy = m->my; m->wh = m->mh; m->wh -= bh * m->showbar * 2; - m->wy = m->showbar ? m->wy + bh : m->wy; + m->wy = m->showbar ? m->wy + bh + gappx : m->wy; if (m->showbar) { - m->by = m->topbar ? m->wy - bh : m->wy + m->wh; - m->eby = m->topbar ? m->wy + m->wh : m->wy - bh; + m->by = m->topbar ? m->wy - bh - gappx : m->wy + m->wh + gappx; + m->eby = m->topbar ? m->wy + m->wh - gappx : m->wy - bh - gappx * 2; + m->wy = topbar ? m->wy : m->wy - gappx * 2; + m->wh = topbar ? m->wh - gappx * 2 : m->wh + gappx * 2; } else { - m->by = -bh; - m->eby = -bh; + m->by = -bh - gappx; + m->eby = -bh + gappx; } } diff --git a/dwm.o b/dwm.o index 5dce9c2..83f6d6a 100644 Binary files a/dwm.o and b/dwm.o differ diff --git a/layouts.c b/layouts.c index ae7e786..39e154d 100644 --- a/layouts.c +++ b/layouts.c @@ -11,18 +11,18 @@ tile(Monitor *m) if (n > m->nmaster) mw = m->nmaster ? m->ww * m->mfact : 0; else - mw = m->ww - m->gappx; - for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + mw = m->ww - gappx; + for (i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if (i < m->nmaster) { - h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; - resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); - if (my + HEIGHT(c) + m->gappx < m->wh) - my += HEIGHT(c) + m->gappx; + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx; + resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx, h - (2*c->bw), 0); + if (my + HEIGHT(c) + gappx < m->wh) + my += HEIGHT(c) + gappx; } else { - h = (m->wh - ty) / (n - i) - m->gappx; - resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); - if (ty + HEIGHT(c) + m->gappx < m->wh) - ty += HEIGHT(c) + m->gappx; + h = (m->wh - ty) / (n - i) - gappx; + resize(c, m->wx + mw + gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*gappx, h - (2*c->bw), 0); + if (ty + HEIGHT(c) + gappx < m->wh) + ty += HEIGHT(c) + gappx; } }