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))
|
2019-12-29 09:12:00 +01:00
|
|
|
fonts[0] = strdup(xval.addr);
|
2020-03-29 12:45:39 +02:00
|
|
|
else
|
|
|
|
fonts[0] = strdup(fonts[0]);
|
|
|
|
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]);
|
2019-12-29 09:12:00 +01:00
|
|
|
|
|
|
|
XrmDestroyDatabase(xdb);
|
|
|
|
}
|
|
|
|
}
|