reusing config.h's color values, note we have to use const char *, instead of const char [] here, because the pointer might change d2305e4b
Anselm R Garbe · 2008-06-14 10:55 2 file(s) · +15 −20
config.h +7 −7
1 1
/* See LICENSE file for copyright and license details. */
2 2
3 3
/* appearance */
4 -
#define FONT          "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"
5 -
#define NORMBGCOLOR   "#cccccc"
6 -
#define NORMFGCOLOR   "#000000"
7 -
#define SELBGCOLOR    "#0066ff"
8 -
#define SELFGCOLOR    "#ffffff"
4 +
static const char *font        = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
5 +
static const char *normbgcolor = "#cccccc";
6 +
static const char *normfgcolor = "#000000";
7 +
static const char *selbgcolor  = "#0066ff";
8 +
static const char *selfgcolor  = "#ffffff";
9 9
10 -
static uint spaceitem = 30; /* px between menu items */
10 +
static uint spaceitem          = 30; /* px between menu items */
11 11
12 12
#ifdef XINERAMA
13 -
static uint xidx      = 0;        /* Xinerama screen index to use */
13 +
static uint xidx               = 0;  /* Xinerama screen index to use */
14 14
#endif
dmenu.c +8 −13
68 68
#include "config.h"
69 69
70 70
/* variables */
71 -
static char *font = FONT;
72 71
static char *maxname = NULL;
73 -
static char *normbg = NORMBGCOLOR;
74 -
static char *normfg = NORMFGCOLOR;
75 72
static char *prompt = NULL;
76 -
static char *selbg = SELBGCOLOR;
77 -
static char *selfg = SELFGCOLOR;
78 73
static char text[4096];
79 74
static int cmdw = 0;
80 75
static int promptw = 0;
618 613
	XFreeModifiermap(modmap);
619 614
620 615
	/* style */
621 -
	dc.norm[ColBG] = getcolor(normbg);
622 -
	dc.norm[ColFG] = getcolor(normfg);
623 -
	dc.sel[ColBG] = getcolor(selbg);
624 -
	dc.sel[ColFG] = getcolor(selfg);
616 +
	dc.norm[ColBG] = getcolor(normbgcolor);
617 +
	dc.norm[ColFG] = getcolor(normfgcolor);
618 +
	dc.sel[ColBG] = getcolor(selbgcolor);
619 +
	dc.sel[ColFG] = getcolor(selfgcolor);
625 620
	initfont(font);
626 621
627 622
	/* menu window */
704 699
			if(++i < argc) font = argv[i];
705 700
		}
706 701
		else if(!strcmp(argv[i], "-nb")) {
707 -
			if(++i < argc) normbg = argv[i];
702 +
			if(++i < argc) normbgcolor = argv[i];
708 703
		}
709 704
		else if(!strcmp(argv[i], "-nf")) {
710 -
			if(++i < argc) normfg = argv[i];
705 +
			if(++i < argc) normfgcolor = argv[i];
711 706
		}
712 707
		else if(!strcmp(argv[i], "-p")) {
713 708
			if(++i < argc) prompt = argv[i];
714 709
		}
715 710
		else if(!strcmp(argv[i], "-sb")) {
716 -
			if(++i < argc) selbg = argv[i];
711 +
			if(++i < argc) selbgcolor = argv[i];
717 712
		}
718 713
		else if(!strcmp(argv[i], "-sf")) {
719 -
			if(++i < argc) selfg = argv[i];
714 +
			if(++i < argc) selfgcolor = argv[i];
720 715
		}
721 716
		else if(!strcmp(argv[i], "-v"))
722 717
			eprint("dmenu-"VERSION", © 2006-2008 dmenu engineers, see LICENSE for details\n");