2019-12-29 09:12:00 +01:00
|
|
|
#include <X11/Xresource.h>
|
|
|
|
|
|
|
|
void
|
2020-03-29 12:45:39 +02:00
|
|
|
readxresources(void)
|
2019-12-29 09:12:00 +01:00
|
|
|
{
|
|
|
|
XrmInitialize();
|
|
|
|
|
2020-03-29 12:45:39 +02:00
|
|
|
char* xrm;
|
|
|
|
if ((xrm = XResourceManagerString(drw->dpy))) {
|
2019-12-29 09:12:00 +01:00
|
|
|
char *type;
|
|
|
|
XrmDatabase xdb = XrmGetStringDatabase(xrm);
|
|
|
|
XrmValue xval;
|
|
|
|
|
2020-03-29 12:45:39 +02:00
|
|
|
if (XrmGetResource(xdb, "dmenu.font", "*", &type, &xval))
|
2020-06-13 15:32:41 +02:00
|
|
|
#if PANGO_PATCH
|
|
|
|
strcpy(font, xval.addr);
|
|
|
|
#else
|
2019-12-29 09:12:00 +01:00
|
|
|
fonts[0] = strdup(xval.addr);
|
2020-06-13 15:32:41 +02:00
|
|
|
#endif // PANGO_PATCH
|
|
|
|
#if !PANGO_PATCH
|
2020-03-29 12:45:39 +02:00
|
|
|
else
|
|
|
|
fonts[0] = strdup(fonts[0]);
|
2020-06-13 15:32:41 +02:00
|
|
|
#endif // PANGO_PATCH
|
2020-03-29 12:45:39 +02:00
|
|
|
if (XrmGetResource(xdb, "dmenu.background", "*", &type, &xval))
|
|
|
|
colors[SchemeNorm][ColBg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeNorm][ColBg] = strdup(colors[SchemeNorm][ColBg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.foreground", "*", &type, &xval))
|
2019-12-29 09:12:00 +01:00
|
|
|
colors[SchemeNorm][ColFg] = strdup(xval.addr);
|
2020-03-29 12:45:39 +02:00
|
|
|
else
|
|
|
|
colors[SchemeNorm][ColFg] = strdup(colors[SchemeNorm][ColFg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.selbackground", "*", &type, &xval))
|
2019-12-29 09:12:00 +01:00
|
|
|
colors[SchemeSel][ColBg] = strdup(xval.addr);
|
2020-03-29 12:45:39 +02:00
|
|
|
else
|
|
|
|
colors[SchemeSel][ColBg] = strdup(colors[SchemeSel][ColBg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.selforeground", "*", &type, &xval))
|
2019-12-29 09:12:00 +01:00
|
|
|
colors[SchemeSel][ColFg] = strdup(xval.addr);
|
2020-03-29 12:45:39 +02:00
|
|
|
else
|
|
|
|
colors[SchemeSel][ColFg] = strdup(colors[SchemeSel][ColFg]);
|
2020-06-03 17:27:40 +02:00
|
|
|
if (XrmGetResource(xdb, "dmenu.outbackground", "*", &type, &xval))
|
|
|
|
colors[SchemeOut][ColBg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeOut][ColBg] = strdup(colors[SchemeOut][ColBg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.outforeground", "*", &type, &xval))
|
|
|
|
colors[SchemeOut][ColFg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeOut][ColFg] = strdup(colors[SchemeOut][ColFg]);
|
|
|
|
#if FUZZYHIGHLIGHT_PATCH
|
|
|
|
if (XrmGetResource(xdb, "dmenu.selhlbackground", "*", &type, &xval))
|
|
|
|
colors[SchemeSelHighlight][ColBg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeSelHighlight][ColBg] = strdup(colors[SchemeSelHighlight][ColBg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.selhlforeground", "*", &type, &xval))
|
|
|
|
colors[SchemeSelHighlight][ColFg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeSelHighlight][ColFg] = strdup(colors[SchemeSelHighlight][ColFg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.hlbackground", "*", &type, &xval))
|
|
|
|
colors[SchemeNormHighlight][ColBg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeNormHighlight][ColBg] = strdup(colors[SchemeNormHighlight][ColBg]);
|
|
|
|
if (XrmGetResource(xdb, "dmenu.hlforeground", "*", &type, &xval))
|
|
|
|
colors[SchemeNormHighlight][ColFg] = strdup(xval.addr);
|
|
|
|
else
|
|
|
|
colors[SchemeNormHighlight][ColFg] = strdup(colors[SchemeNormHighlight][ColFg]);
|
|
|
|
#endif // FUZZYHIGHLIGHT_PATCH
|
2019-12-29 09:12:00 +01:00
|
|
|
|
|
|
|
XrmDestroyDatabase(xdb);
|
|
|
|
}
|
|
|
|
}
|