aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvxid <maxime.treca@gmail.com>2019-04-09 11:27:32 +0200
committerBert Münnich <ber.t@posteo.de>2019-04-19 15:03:03 +0200
commit4407a3de54e0239ab1354d63cc6408051474fce2 (patch)
treed48192b29cb938b571803e05dfdfe1e608a1f5c4
parenta75411567e6670a1ce37f0db5d7d79bd19a21d3b (diff)
Add Xresources font support
-rw-r--r--config.def.h1
-rw-r--r--window.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/config.def.h b/config.def.h
index 1e9beb0..a1c123a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -7,6 +7,7 @@ enum {
};
/* bar font:
+ * overwritten by the 'font' X resource property.
* (see fonts-conf(5) subsection "FONT NAMES" for valid values)
*/
static const char * const BAR_FONT = "monospace:size=8";
diff --git a/window.c b/window.c
index 9879880..704a7e0 100644
--- a/window.c
+++ b/window.c
@@ -134,7 +134,7 @@ unsigned int win_luminance(const XftColor *col)
void win_init(win_t *win)
{
win_env_t *e;
- const char *bg, *fg;
+ const char *bg, *fg, *f;
memset(win, 0, sizeof(win_t));
@@ -152,7 +152,8 @@ void win_init(win_t *win)
if (setlocale(LC_CTYPE, "") == NULL || XSupportsLocale() == 0)
error(0, 0, "No locale support");
- win_init_font(e, BAR_FONT);
+ f = win_res(e->dpy, RES_CLASS ".font", BAR_FONT);
+ win_init_font(e, f);
bg = win_res(e->dpy, RES_CLASS ".background", BG_COLOR);
fg = win_res(e->dpy, RES_CLASS ".foreground", FG_COLOR);