]> git.armaanb.net Git - dmenu.git/blobdiff - dmenu.c
init colors using SchemeLast
[dmenu.git] / dmenu.c
diff --git a/dmenu.c b/dmenu.c
index 9278e916f6e4f6079e5c05b8abec274c457b394f..91330f191f7b219aff9217c1e20bf51afeb769c4 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -228,7 +228,7 @@ match(void)
        len = tokc ? strlen(tokv[0]) : 0;
 
        matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL;
-       textsize = strlen(text);
+       textsize = strlen(text) + 1;
        for (item = items; item && item->text; item++) {
                for (i = 0; i < tokc; i++)
                        if (!fstrstr(item->text, tokv[i]))
@@ -539,21 +539,22 @@ run(void)
 static void
 setup(void)
 {
-       int x, y;
+       int x, y, i = 0;
+       unsigned int du;
        XSetWindowAttributes swa;
        XIM xim;
+       Window w, dw, *dws;
+       XWindowAttributes wa;
+       XClassHint ch = {"dmenu", "dmenu"};
 #ifdef XINERAMA
        XineramaScreenInfo *info;
-       Window w, pw, dw, *dws;
-       XWindowAttributes wa;
-       int a, j, di, n, i = 0, area = 0;
-       unsigned int du;
+       Window pw;
+       int a, j, di, n, area = 0;
 #endif
 
        /* init appearance */
-       scheme[SchemeNorm] = drw_scm_create(drw, colors[SchemeNorm], 2);
-       scheme[SchemeSel] = drw_scm_create(drw, colors[SchemeSel], 2);
-       scheme[SchemeOut] = drw_scm_create(drw, colors[SchemeOut], 2);
+       for (j = 0; j < SchemeLast; j++)
+               scheme[j] = drw_scm_create(drw, colors[j], 2);
 
        clip = XInternAtom(dpy, "CLIPBOARD",   False);
        utf8 = XInternAtom(dpy, "UTF8_STRING", False);
@@ -612,6 +613,7 @@ setup(void)
        win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
                            CopyFromParent, CopyFromParent, CopyFromParent,
                            CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
+       XSetClassHint(dpy, win, &ch);
 
        /* open input methods */
        xim = XOpenIM(dpy, NULL, NULL, NULL);