mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
Adding xresources patch
This commit is contained in:
parent
687e10f42c
commit
9147fb7202
@ -15,6 +15,8 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/)
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2019-12-29 - Added xresources patch
|
||||||
|
|
||||||
2019-10-16 - Introduced [flexipatch-finalizer](https://github.com/bakkeby/flexipatch-finalizer)
|
2019-10-16 - Introduced [flexipatch-finalizer](https://github.com/bakkeby/flexipatch-finalizer)
|
||||||
|
|
||||||
2019-09-18 - Added border, center, fuzzymatch, incremental, initialtext, instant, line-height, mouse-support, navhistory, non-blocking-stdin, password, pipeout, printinputtext, rejectnomatch, scroll, vertfull, wmtype and xyw patches
|
2019-09-18 - Added border, center, fuzzymatch, incremental, initialtext, instant, line-height, mouse-support, navhistory, non-blocking-stdin, password, pipeout, printinputtext, rejectnomatch, scroll, vertfull, wmtype and xyw patches
|
||||||
@ -82,5 +84,9 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/)
|
|||||||
- [wmtype](https://github.com/Baitinq/dmenu/blob/master/patches/dmenu-wm_type.diff)
|
- [wmtype](https://github.com/Baitinq/dmenu/blob/master/patches/dmenu-wm_type.diff)
|
||||||
- adds extended window manager hints such as \_NET_WM_WINDOW_TYPE and \_NET_WM_WINDOW_TYPE_DOCK
|
- adds extended window manager hints such as \_NET_WM_WINDOW_TYPE and \_NET_WM_WINDOW_TYPE_DOCK
|
||||||
|
|
||||||
|
- [xresources](https://tools.suckless.org/dmenu/patches/xresources/)
|
||||||
|
- allows dmenu to read font and colors from Xresources
|
||||||
|
- note that with this patch the Xresources settings takes precedence over command line arguments
|
||||||
|
|
||||||
- [xyw](https://tools.suckless.org/dmenu/patches/xyw/)
|
- [xyw](https://tools.suckless.org/dmenu/patches/xyw/)
|
||||||
- adds options for specifying dmenu window position and width
|
- adds options for specifying dmenu window position and width
|
4
dmenu.c
4
dmenu.c
@ -1186,7 +1186,11 @@ main(int argc, char *argv[])
|
|||||||
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
||||||
die("could not get embedding window attributes: 0x%lx",
|
die("could not get embedding window attributes: 0x%lx",
|
||||||
parentwin);
|
parentwin);
|
||||||
|
|
||||||
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
||||||
|
#if XRESOURCES_PATCH
|
||||||
|
read_Xresources();
|
||||||
|
#endif // XRESOURCES_PATCH
|
||||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||||
die("no fonts could be loaded.");
|
die("no fonts could be loaded.");
|
||||||
lrpad = drw->fonts->h;
|
lrpad = drw->fonts->h;
|
||||||
|
@ -12,4 +12,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#if NON_BLOCKING_STDIN_PATCH
|
#if NON_BLOCKING_STDIN_PATCH
|
||||||
#include "nonblockingstdin.c"
|
#include "nonblockingstdin.c"
|
||||||
|
#endif
|
||||||
|
#if XRESOURCES_PATCH
|
||||||
|
#include "xresources.c"
|
||||||
#endif
|
#endif
|
27
patch/xresources.c
Normal file
27
patch/xresources.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <X11/Xresource.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
read_Xresources(void)
|
||||||
|
{
|
||||||
|
XrmInitialize();
|
||||||
|
|
||||||
|
char* xrm = XResourceManagerString(drw->dpy);
|
||||||
|
if (xrm) {
|
||||||
|
char *type;
|
||||||
|
XrmDatabase xdb = XrmGetStringDatabase(xrm);
|
||||||
|
XrmValue xval;
|
||||||
|
|
||||||
|
if (XrmGetResource(xdb, "dmenu.font", "*", &type, &xval) == True) /* font or font set */
|
||||||
|
fonts[0] = strdup(xval.addr);
|
||||||
|
if (XrmGetResource(xdb, "dmenu.background", "*", &type, &xval) == True) /* normal background color */
|
||||||
|
colors[SchemeSel][ColBg] = strdup(xval.addr);
|
||||||
|
if (XrmGetResource(xdb, "dmenu.foreground", "*", &type, &xval) == True) /* normal foreground color */
|
||||||
|
colors[SchemeNorm][ColFg] = strdup(xval.addr);
|
||||||
|
if (XrmGetResource(xdb, "dmenu.selbackground", "*", &type, &xval) == True) /* selected background color */
|
||||||
|
colors[SchemeSel][ColBg] = strdup(xval.addr);
|
||||||
|
if (XrmGetResource(xdb, "dmenu.selforeground", "*", &type, &xval) == True) /* selected foreground color */
|
||||||
|
colors[SchemeSel][ColFg] = strdup(xval.addr);
|
||||||
|
|
||||||
|
XrmDestroyDatabase(xdb);
|
||||||
|
}
|
||||||
|
}
|
13
patches.h
13
patches.h
@ -103,8 +103,19 @@
|
|||||||
*/
|
*/
|
||||||
#define WMTYPE_PATCH 0
|
#define WMTYPE_PATCH 0
|
||||||
|
|
||||||
|
/* This patch adds the ability to configure dmenu via Xresources. At startup, dmenu will read and
|
||||||
|
* apply the resources named below:
|
||||||
|
* dmenu.font : font or font set
|
||||||
|
* dmenu.background : normal background color
|
||||||
|
* dmenu.foreground : normal foreground color
|
||||||
|
* dmenu.selbackground : selected background color
|
||||||
|
* dmenu.selforeground : selected foreground color
|
||||||
|
* https://tools.suckless.org/dmenu/patches/xresources/
|
||||||
|
*/
|
||||||
|
#define XRESOURCES_PATCH 0
|
||||||
|
|
||||||
/* This patch adds options for specifying dmenu window position and width.
|
/* This patch adds options for specifying dmenu window position and width.
|
||||||
* The center patch takes precedence over the XYW patch if enabled.
|
* The center patch takes precedence over the XYW patch if enabled.
|
||||||
* https://tools.suckless.org/dmenu/patches/xyw/
|
* https://tools.suckless.org/dmenu/patches/xyw/
|
||||||
*/
|
*/
|
||||||
#define XYW_PATCH 0
|
#define XYW_PATCH 0
|
||||||
|
Loading…
Reference in New Issue
Block a user