new colorscheme (16-bit compliant) 2091200c
Anselm R. Garbe · 2007-09-15 20:39 4 file(s) · +14 −15
bar.c +9 −4
69 69
		if(dc.font.xfont)
70 70
			XFreeFont(dpy, dc.font.xfont);
71 71
		dc.font.xfont = NULL;
72 -
		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)))
72 +
		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
73 +
		|| !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
73 74
			eprint("error, cannot load font: '%s'\n", fontstr);
74 75
		dc.font.ascent = dc.font.xfont->ascent;
75 76
		dc.font.descent = dc.font.xfont->descent;
186 187
}
187 188
188 189
void
189 -
initbar(void) {
190 -
	XSetWindowAttributes wa;
191 -
190 +
initstyle(void) {
192 191
	dc.norm[ColBorder] = initcolor(NORMBORDERCOLOR);
193 192
	dc.norm[ColBG] = initcolor(NORMBGCOLOR);
194 193
	dc.norm[ColFG] = initcolor(NORMFGCOLOR);
197 196
	dc.sel[ColFG] = initcolor(SELFGCOLOR);
198 197
	initfont(FONT);
199 198
	dc.h = bh = dc.font.height + 2;
199 +
}
200 +
201 +
void
202 +
initbar(void) {
203 +
	XSetWindowAttributes wa;
204 +
200 205
	wa.override_redirect = 1;
201 206
	wa.background_pixmap = ParentRelative;
202 207
	wa.event_mask = ButtonPressMask | ExposureMask;
config.h +3 −11
4 4
#define BARPOS			BarTop /* BarBot, BarOff */
5 5
#define BORDERPX		1
6 6
#define FONT			"-*-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-*"
7 -
#define DARK /* LIGHT */
8 -
#ifdef DARK
9 -
#define NORMBORDERCOLOR		"#222"
7 +
#define NORMBORDERCOLOR		"#333"
10 8
#define NORMBGCOLOR		"#000"
11 -
#define NORMFGCOLOR		"#ddd"
12 -
#define SELBORDERCOLOR		"#09f"
13 -
#else
14 -
#define NORMBORDERCOLOR		"#666"
15 -
#define NORMBGCOLOR		"#eee"
16 -
#define NORMFGCOLOR		"#222"
9 +
#define NORMFGCOLOR		"#ccc"
17 10
#define SELBORDERCOLOR		"#f00"
18 -
#endif
19 -
#define SELBGCOLOR		"#369"
11 +
#define SELBGCOLOR		"#00f"
20 12
#define SELFGCOLOR		"#fff"
21 13
22 14
/* tagging */
dwm.h +1 −0
91 91
/* bar.c */
92 92
void drawbar(void);			/* draw the bar */
93 93
void initbar(void);			/* initializes the bar */
94 +
void initstyle(void);			/* initializes colors and font */
94 95
unsigned int textw(const char *text);	/* return the width of text in px*/
95 96
void togglebar(const char *arg);	/* shows/hides the bar */
96 97
void updatebarpos(void);		/* updates the bar position */
main.c +1 −0
148 148
	sx = sy = 0;
149 149
	sw = DisplayWidth(dpy, screen);
150 150
	sh = DisplayHeight(dpy, screen);
151 +
	initstyle();
151 152
	initlayouts();
152 153
	initbar();
153 154
	/* multihead support */