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