3->4 colors
2e0c767d
6 file(s) · +22 −26
| 8 | 8 | ||
| 9 | 9 | #define DEFMODE dotile /* dofloat */ |
|
| 10 | 10 | #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" |
|
| 11 | - | #define BGCOLOR "#666699" |
|
| 12 | - | #define FGCOLOR "#eeeeee" |
|
| 13 | - | #define BORDERCOLOR "#9999CC" |
|
| 11 | + | #define NORMBGCOLOR "#666699" |
|
| 12 | + | #define NORMFGCOLOR "#eeeeee" |
|
| 13 | + | #define SELBGCOLOR "#eeeeee" |
|
| 14 | + | #define SELFGCOLOR "#000088" |
|
| 14 | 15 | #define MODKEY Mod1Mask |
|
| 15 | 16 | #define MASTERW 60 /* percent */ |
|
| 16 | 17 |
| 8 | 8 | ||
| 9 | 9 | #define DEFMODE dotile /* dofloat */ |
|
| 10 | 10 | #define FONT "fixed" |
|
| 11 | - | #define BGCOLOR "#666699" |
|
| 12 | - | #define FGCOLOR "#eeeeee" |
|
| 13 | - | #define BORDERCOLOR "#9999CC" |
|
| 11 | + | #define NORMBGCOLOR "#666699" |
|
| 12 | + | #define NORMFGCOLOR "#eeeeee" |
|
| 13 | + | #define SELBGCOLOR "#eeeeee" |
|
| 14 | + | #define SELFGCOLOR "#666699" |
|
| 14 | 15 | #define MODKEY Mod1Mask |
|
| 15 | 16 | #define MASTERW 60 /* percent */ |
|
| 16 | 17 |
| 1 | 1 | # dwm version |
|
| 2 | - | VERSION = 1.0 |
|
| 2 | + | VERSION = 1.1 |
|
| 3 | 3 | ||
| 4 | 4 | # Customize below to fit your system |
|
| 5 | 5 |
| 22 | 22 | } |
|
| 23 | 23 | ||
| 24 | 24 | static void |
|
| 25 | - | drawtext(const char *text, Bool invert, Bool highlight) |
|
| 25 | + | drawtext(const char *text, unsigned int colidx, Bool highlight) |
|
| 26 | 26 | { |
|
| 27 | 27 | int x, y, w, h; |
|
| 28 | 28 | static char buf[256]; |
|
| 29 | 29 | unsigned int len, olen; |
|
| 30 | - | XGCValues gcv; |
|
| 31 | 30 | XPoint points[5]; |
|
| 32 | 31 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 33 | 32 | ||
| 34 | - | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
|
| 33 | + | XSetForeground(dpy, dc.gc, dc.bg[colidx]); |
|
| 35 | 34 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 36 | 35 | points[0].x = dc.x; |
|
| 37 | 36 | points[0].y = dc.y; |
|
| 43 | 42 | points[3].y = 0; |
|
| 44 | 43 | points[4].x = 0; |
|
| 45 | 44 | points[4].y = -(dc.h - 1); |
|
| 46 | - | XSetForeground(dpy, dc.gc, dc.border); |
|
| 45 | + | XSetForeground(dpy, dc.gc, dc.fg[colidx]); |
|
| 47 | 46 | XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); |
|
| 48 | 47 | ||
| 49 | 48 | if(!text) |
|
| 74 | 73 | ||
| 75 | 74 | if(w > dc.w) |
|
| 76 | 75 | return; /* too long */ |
|
| 77 | - | gcv.foreground = invert ? dc.bg : dc.fg; |
|
| 78 | - | gcv.background = invert ? dc.fg : dc.bg; |
|
| 79 | - | if(dc.font.set) { |
|
| 80 | - | XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); |
|
| 76 | + | if(dc.font.set) |
|
| 81 | 77 | XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); |
|
| 82 | - | } |
|
| 83 | 78 | else { |
|
| 84 | - | gcv.font = dc.font.xfont->fid; |
|
| 85 | - | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
|
| 79 | + | XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
|
| 86 | 80 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 87 | 81 | } |
|
| 88 | 82 | if(highlight) { |
|
| 157 | 151 | if(c == sel && issel) { |
|
| 158 | 152 | drawstatus(); |
|
| 159 | 153 | XUnmapWindow(dpy, c->twin); |
|
| 160 | - | XSetWindowBorder(dpy, c->win, dc.fg); |
|
| 154 | + | XSetWindowBorder(dpy, c->win, dc.fg[1]); |
|
| 161 | 155 | return; |
|
| 162 | 156 | } |
|
| 163 | 157 | ||
| 164 | - | XSetWindowBorder(dpy, c->win, dc.bg); |
|
| 158 | + | XSetWindowBorder(dpy, c->win, dc.bg[0]); |
|
| 165 | 159 | XMapWindow(dpy, c->twin); |
|
| 166 | 160 | dc.x = dc.y = 0; |
|
| 167 | 161 | dc.w = c->tw; |
|
| 36 | 36 | ||
| 37 | 37 | typedef struct { /* draw context */ |
|
| 38 | 38 | int x, y, w, h; |
|
| 39 | - | unsigned long bg; |
|
| 40 | - | unsigned long fg; |
|
| 41 | - | unsigned long border; |
|
| 39 | + | unsigned long bg[2]; |
|
| 40 | + | unsigned long fg[2]; |
|
| 42 | 41 | Drawable drawable; |
|
| 43 | 42 | Fnt font; |
|
| 44 | 43 | GC gc; |
| 121 | 121 | seltag[0] = True; |
|
| 122 | 122 | ||
| 123 | 123 | /* style */ |
|
| 124 | - | dc.bg = getcolor(BGCOLOR); |
|
| 125 | - | dc.fg = getcolor(FGCOLOR); |
|
| 126 | - | dc.border = getcolor(BORDERCOLOR); |
|
| 124 | + | dc.bg[0] = getcolor(NORMBGCOLOR); |
|
| 125 | + | dc.fg[0] = getcolor(NORMFGCOLOR); |
|
| 126 | + | dc.bg[1] = getcolor(SELBGCOLOR); |
|
| 127 | + | dc.fg[1] = getcolor(SELFGCOLOR); |
|
| 127 | 128 | setfont(FONT); |
|
| 128 | 129 | ||
| 129 | 130 | sx = sy = 0; |