X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=8cc95715ad7b13689de518aa966492e4e7f9a32c;hp=e1ea9b4c86ac0db4ff25c7b65032b2021fe0e40c;hb=271b0614b4ecf0670ca9f9f89edb983055920ece;hpb=3c838bad8f1825b710ea0f2acaa184391db12de2 diff --git a/dwm.c b/dwm.c index e1ea9b4..8cc9571 100644 --- a/dwm.c +++ b/dwm.c @@ -55,7 +55,8 @@ #define WIDTH(X) ((X)->w + 2 * (X)->bw) #define HEIGHT(X) ((X)->h + 2 * (X)->bw) #define TAGMASK ((1 << LENGTH(tags)) - 1) -#define TEXTW(X) (drw_font_getexts_width(drw->font, X, strlen(X)) + drw->font->h) +#define TEXTW_NOPAD(X) drw_font_getexts_width(drw->font, X, strlen(X)) +#define TEXTW(X) (TEXTW_NOPAD(X) + drw->font->h) /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ @@ -241,13 +242,13 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); -/* variables */ +// variables static Bool key_buffering = False; static const char broken[] = "broken"; static char stext[256]; static int screen; -static int sw, sh; /* X display screen geometry width, height */ -static int bh, blw = 0; /* bar geometry */ +static int sw, sh; // X display screen geometry width, height +static int bh; // bar height static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0; static void (*handler[LASTEvent]) (XEvent *) = { @@ -654,7 +655,7 @@ configurenotify(XEvent *e) { drw_resize(drw, sw, bh); updatebars(); for(m = mons; m; m = m->next) - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); + XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww * m->mfact, bh); focus(NULL); arrange(NULL); } @@ -804,24 +805,18 @@ drawbar(Monitor *m) { } x = 0; for(i = 0; i < LENGTH(tags); i++) { - w = TEXTW(tags[i]); + w = TEXTW_NOPAD(tags[i]); drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]); - drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i); - drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - occ & 1 << i, urg & 1 << i); + drw_text_nopad(drw, x, 0, w, bh, tags[i], urg & 1 << i); x += w; } - w = blw = TEXTW(m->ltsymbol); - drw_setscheme(drw, &scheme[SchemeNorm]); - drw_text(drw, x, 0, w, bh, m->ltsymbol, 0); - x += w; xx = x; if(m == selmon) { /* status is only drawn on selected monitor */ w = TEXTW(stext); - x = m->ww - w; + x = m->ww * m->mfact - w; if(x < xx) { x = xx; - w = m->ww - xx; + w = m->ww* m->mfact - xx; } drw_text(drw, x, 0, w, bh, stext, 0); } @@ -833,8 +828,7 @@ drawbar(Monitor *m) { drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]); drw_text(drw, x, 0, w, bh, m->sel->name, 0); drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0); - } - else { + } else { drw_setscheme(drw, &scheme[SchemeNorm]); drw_text(drw, x, 0, w, bh, NULL, 0); } @@ -1751,7 +1745,7 @@ kbspawn(const Arg *arg) { void spawn(const Arg *arg) { int tag = 0, i; - if(arg->v == termcmd || arg->v == runcmd) { + if(arg->v == termcmd || arg->v == belltermcmd || arg->v == runcmd) { for(i = 0; i < 32; ++i) { if(selmon->tagset[selmon->seltags] & (1 << i)) { tag = i; @@ -1821,9 +1815,9 @@ tile(Monitor *m) { } } -#define TAB_HEIGHT 19 -#define TAB_PAD 7 -#define GUTTER_PX 8 +#define GUTTER_PX 4 +#define TAB_HEIGHT (bh / 2 - GUTTER_PX) +#define TAB_PAD GUTTER_PX void jason_layout(Monitor *m) { @@ -1861,20 +1855,34 @@ jason_layout(Monitor *m) { } right_width = m->ww - mw - GUTTER_PX; tab_count = &(tab_counts[0]); - tab_top = m->wy - (m->wh - (2 * (TAB_HEIGHT + TAB_PAD))) + TAB_HEIGHT; + tab_top = m->my - m->wh + TAB_HEIGHT; for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { if (i == 0) { resize(c, m->wx, m->wy, mw, m->wh, False, 0); } else { if (c == vis_slave) { - resize(c, m->wx + mw + GUTTER_PX, m->wy + TAB_HEIGHT + TAB_PAD, right_width, m->wh - 2 * (TAB_HEIGHT + TAB_PAD), False, base); + resize(c, + m->wx + mw + GUTTER_PX, + m->my + TAB_HEIGHT + TAB_PAD, + right_width, + m->wh, + False, + base + ); tab_count = &(tab_counts[1]); - tab_top = m->wy + m->wh - TAB_HEIGHT; + tab_top = m->my + m->mh - TAB_HEIGHT; cur_tab = 0; } else { // this function does not get called when focus changes // resize(c, m->wx + m->ww, m->wy, m->ww - mw, m->wh, False); - resize(c, m->wx + mw + GUTTER_PX + right_width * cur_tab / (*tab_count), tab_top, right_width, m->wh - 2 * (TAB_HEIGHT + TAB_PAD), False, base); + resize(c, + m->wx + mw + GUTTER_PX + right_width * cur_tab / (*tab_count), + tab_top, + right_width, + m->wh, + False, + base + ); cur_tab += 1; } } @@ -1989,7 +1997,7 @@ updatebars(void) { for(m = mons; m; m = m->next) { if (m->barwin) continue; - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), + m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww * m->mfact, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XChangeProperty(dpy, root, netatom[NetSupportingWMCheck], XA_WINDOW, 32,