From d7b259be346091fad33ce27b155586c8d96bc615 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 8 Jun 2021 14:12:46 +0200 Subject: [PATCH] message patch: add xresources compatibility ref. #3 --- config.def.h | 25 ++++++++++++++----------- patch/colormessage.c | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/config.def.h b/config.def.h index 8e6b1f5eb2e6568735a8a07d00f2140f6bee8500..ac9ec206660dbe5b8e82473e100058caf3abe28a 100644 --- a/config.def.h +++ b/config.def.h @@ -17,6 +17,17 @@ static const char *colorname[NUMCOLS] = { #endif // KEYPRESS_FEEDBACK_PATCH }; +#if MESSAGE_PATCH || COLOR_MESSAGE_PATCH +/* default message */ +static const char * message = "Suckless: Software that sucks less."; + +/* text color */ +static const char * text_color = "#ffffff"; + +/* text size (must be a valid size) */ +static const char * font_name = "6x10"; +#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH + #if XRESOURCES_PATCH /* * Xresources preferences to load at startup @@ -31,6 +42,9 @@ ResourcePref resources[] = { #if PAMAUTH_PATCH { "color5", STRING, &colorname[PAM] }, #endif // PAMAUTH_PATCH + #if MESSAGE_PATCH || COLOR_MESSAGE_PATCH + { "color6", STRING, &text_color }, + #endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH }; #endif // XRESOURCES_PATCH @@ -76,17 +90,6 @@ static const int blocks_y = 0; static const int blocks_count = 10; #endif // KEYPRESS_FEEDBACK_PATCH -#if MESSAGE_PATCH || COLOR_MESSAGE_PATCH -/* default message */ -static const char * message = "Suckless: Software that sucks less."; - -/* text color */ -static const char * text_color = "#ffffff"; - -/* text size (must be a valid size) */ -static const char * font_name = "6x10"; -#endif // MESSAGE_PATCH | COLOR_MESSAGE_PATCH - #if PAMAUTH_PATCH /* PAM service that's used for authentication */ static const char* pam_service = "login"; diff --git a/patch/colormessage.c b/patch/colormessage.c index 3db13f9125a250e37c88128f1f89fd77021f3c19..0d53537220ac780df26aba94a3349195828a51fd 100644 --- a/patch/colormessage.c +++ b/patch/colormessage.c @@ -38,7 +38,7 @@ writemessage(Display *dpy, Window win, int screen) tab_size = 8 * XTextWidth(fontinfo, " ", 1); XAllocNamedColor(dpy, DefaultColormap(dpy, screen), - text_color, &color, &dummy); + text_color, &color, &dummy); gr_values.font = fontinfo->fid; gr_values.foreground = color.pixel;