--- src/dmenu2-0.2/dmenu.c 2013-11-26 09:15:04.000000000 +0100 +++ dmenu_patched.c 2015-03-22 16:52:28.983695802 +0100 @@ -77,6 +77,8 @@ static Bool filter = False; static Bool maskin = False; static Bool noinput = False; +static Bool centered_horiz = False; +static Bool centered_vert = False; static int ret = 0; static Bool quiet = False; static DC *dc; @@ -108,6 +110,14 @@ } else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ topbar = False; + else if(!strcmp(argv[i], "-c")) { + centered_horiz = True; + centered_vert = True; + } + else if(!strcmp(argv[i], "-ch")) + centered_horiz = True; + else if(!strcmp(argv[i], "-cv")) + centered_vert = True; else if(!strcmp(argv[i], "-q")) quiet = True; else if(!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ @@ -879,7 +889,10 @@ promptw = (prompt && *prompt) ? textw(dc, prompt) : 0; inputw = MIN(inputw, mw/3); match(); - + + if(centered_horiz) x = (dimx + dimw/2 - mw/2); + if(centered_vert) y = (dimy + dimh/2 - mh/2); + swa.override_redirect = True; /* create dim window */ @@ -930,7 +943,7 @@ void usage(void) { - fputs("usage: dmenu [-b] [-q] [-f] [-r] [-i] [-z] [-t] [-mask] [-noinput]\n" + fputs("usage: dmenu [-b] [-c] [-ch] [-cv] [-q] [-f] [-r] [-i] [-z] [-t] [-mask] [-noinput]\n" " [-s screen] [-name name] [-class class] [ -o opacity]\n" " [-dim opcity] [-dc color] [-l lines] [-p prompt] [-fn font]\n" " [-x xoffset] [-y yoffset] [-h height] [-w width]\n"