From bf8ae57f6a4d96ccd92125b80be55fd203498320 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Fri, 27 Mar 2015 22:52:27 -0300 Subject: Tidied up, added boolean for title bar --- config.h | 2 +- dwm | Bin 41392 -> 41136 bytes dwm.c | 44 +++++++++++++------------------------------- dwm.o | Bin 62184 -> 61800 bytes 4 files changed, 14 insertions(+), 32 deletions(-) diff --git a/config.h b/config.h index b854366..ef4bd24 100644 --- a/config.h +++ b/config.h @@ -16,7 +16,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const Bool showbar = True; /* False means no bar */ static const Bool topbar = False; /* False means bottom bar */ -static const Bool statusmarkup = True; /* True means use pango markup in status message */ +static const Bool showtitle = False; /* True means titles are shown on bar */ /* Display modes of the tab bar: never shown, always shown, shown only in */ /* monocle mode in presence of several windows. */ diff --git a/dwm b/dwm index 8b4ce34..c8be690 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index 8dd5785..91c014f 100644 --- a/dwm.c +++ b/dwm.c @@ -209,8 +209,7 @@ static void focuswin(const Arg* arg); static void focusin(XEvent *e); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); -static unsigned long getcolor(const char *colstr); -static XftColor getcolorxft(const char *colstr); +static XftColor getcolor(const char *colstr); static Bool getrootptr(int *x, int *y); static long getstate(Window w); static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); @@ -821,7 +820,7 @@ drawbar(Monitor *m) { dc.x = 0; for(i = 0; i < LENGTH(tags); i++) { dc.w = TEXTW(tags[i]); - col = (m->tagset[m->seltags] & 1 << i ? 1:(urg & 1 << i ? 2:0)); + col = (m->tagset[m->seltags] & 1 << i ? 1:(urg & 1 << i ? 2 : 0)); drawtext(dc.drawable, tags[i], col, True); drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col); dc.x += dc.w; @@ -841,16 +840,16 @@ drawbar(Monitor *m) { } else dc.x = m->ww; - /*if((dc.w = dc.x - x) > bh) { + if((dc.w = dc.x - x) > bh) { dc.x = x; - if(m->sel) { - col = m == selmon ? dc.colors[1] : dc.colors[0]; - drawtext(dc.drawable, m->sel->name, col, True); // experiment1 - no win title + if(m->sel && showtitle) { + col = m == selmon ? 1 : 0; + drawtext(dc.drawable, m->sel->name, col, True); drawsquare(m->sel->isfixed, m->sel->isfloating, col); } - else*/ + else drawtext(dc.drawable, NULL, 0, False); - //} + } XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0); XSync(dpy, False); } @@ -1024,11 +1023,7 @@ drawtext(Drawable drawable, const char *text, int col, Bool pad) { memcpy(buf, text, len); if(len < olen) for(i = len; i && i > len - 3; buf[--i] = '.'); - /*XSetForeground(dpy, dc.gc, dc.colors[col][ColFG]); - if(dc.font.set) - XmbDrawString(dpy, drawable, dc.font.set, dc.gc, x, y, buf, len); - else - XDrawString(dpy, drawable, dc.gc, x, y, buf, len);*/ + d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy,screen)); XftDrawStringUtf8(d, &dc.xftcolors[col][ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len); @@ -1166,18 +1161,8 @@ getatomprop(Client *c, Atom prop) { return atom; } -unsigned long -getcolor(const char *colstr) { - Colormap cmap = DefaultColormap(dpy, screen); - XColor color; - - if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color)) - die("error, cannot allocate color '%s'\n", colstr); - return color.pixel; -} - XftColor -getcolorxft(const char *colstr) { +getcolor(const char *colstr) { XftColor color; if(!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color)) @@ -1846,12 +1831,9 @@ setup(void) { cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); /* init appearance */ for(int i=0; i