letting dmenu appear at the bottom by default
2bac5599
2 file(s) · +3 −11
| 3 | 3 | dmenu \- dynamic menu |
|
| 4 | 4 | .SH SYNOPSIS |
|
| 5 | 5 | .B dmenu |
|
| 6 | - | .RB [ \-b ] |
|
| 7 | 6 | .RB [ \-fn " <font>"] |
|
| 8 | 7 | .RB [ \-nb " <color>"] |
|
| 9 | 8 | .RB [ \-nf " <color>"] |
|
| 19 | 18 | It manages huge amounts (up to 10.000 and more) of user defined menu items |
|
| 20 | 19 | efficiently. |
|
| 21 | 20 | .SS Options |
|
| 22 | - | .TP |
|
| 23 | - | .B \-b |
|
| 24 | - | makes dmenu appear at the screen bottom (by default it appears at the screen top). |
|
| 25 | 21 | .TP |
|
| 26 | 22 | .B \-fn <font> |
|
| 27 | 23 | defines the font. |
|
| 342 | 342 | ||
| 343 | 343 | int |
|
| 344 | 344 | main(int argc, char *argv[]) { |
|
| 345 | - | Bool bottom = False; |
|
| 346 | 345 | char *font = FONT; |
|
| 347 | 346 | char *maxname; |
|
| 348 | 347 | char *normbg = NORMBGCOLOR; |
|
| 361 | 360 | timeout.tv_sec = 3; |
|
| 362 | 361 | /* command line args */ |
|
| 363 | 362 | for(i = 1; i < argc; i++) |
|
| 364 | - | if(!strncmp(argv[i], "-b", 3)) { |
|
| 365 | - | bottom = True; |
|
| 366 | - | } |
|
| 367 | - | else if(!strncmp(argv[i], "-fn", 4)) { |
|
| 363 | + | if(!strncmp(argv[i], "-fn", 4)) { |
|
| 368 | 364 | if(++i < argc) font = argv[i]; |
|
| 369 | 365 | } |
|
| 370 | 366 | else if(!strncmp(argv[i], "-nb", 4)) { |
|
| 390 | 386 | exit(EXIT_SUCCESS); |
|
| 391 | 387 | } |
|
| 392 | 388 | else |
|
| 393 | - | eprint("usage: dmenu [-b] [-fn <font>] [-nb <color>] [-nf <color>] [-p <prompt>]\n" |
|
| 389 | + | eprint("usage: dmenu [-fn <font>] [-nb <color>] [-nf <color>] [-p <prompt>]\n" |
|
| 394 | 390 | " [-sb <color>] [-sf <color>] [-t <seconds>] [-v]\n", stdout); |
|
| 395 | 391 | setlocale(LC_CTYPE, ""); |
|
| 396 | 392 | dpy = XOpenDisplay(0); |
|
| 434 | 430 | mw = DisplayWidth(dpy, screen); |
|
| 435 | 431 | mh = dc.font.height + 2; |
|
| 436 | 432 | win = XCreateWindow(dpy, root, 0, |
|
| 437 | - | bottom ? DisplayHeight(dpy, screen) - mh : 0, mw, mh, 0, |
|
| 433 | + | DisplayHeight(dpy, screen) - mh, mw, mh, 0, |
|
| 438 | 434 | DefaultDepth(dpy, screen), CopyFromParent, |
|
| 439 | 435 | DefaultVisual(dpy, screen), |
|
| 440 | 436 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
|