applied Martti Kühne's dmenu monitor patch
13f78730
https://gist.github.com/mar77i/3349298/raw/f6581ca96627f4c71c0bd1faf531daaf2a613b95/monarg.patch becomes upstream now
3 file(s) · +14 −4
https://gist.github.com/mar77i/3349298/raw/f6581ca96627f4c71c0bd1faf531daaf2a613b95/monarg.patch becomes upstream now
| 1 | 1 | MIT/X Consortium License |
|
| 2 | 2 | ||
| 3 | + | © 2006-2013 Anselm R Garbe <anselm@garbe.us> |
|
| 3 | 4 | © 2010-2012 Connor Lane Smith <cls@lubutu.com> |
|
| 4 | - | © 2006-2012 Anselm R Garbe <anselm@garbe.us> |
|
| 5 | 5 | © 2009 Gottox <gottox@s01.de> |
|
| 6 | 6 | © 2009 Markus Schnalke <meillo@marmaro.de> |
|
| 7 | 7 | © 2009 Evan Gates <evan.gates@gmail.com> |
| 7 | 7 | .RB [ \-f ] |
|
| 8 | 8 | .RB [ \-i ] |
|
| 9 | 9 | .RB [ \-l |
|
| 10 | + | .RB [ \-m |
|
| 11 | + | .IR monitor ] |
|
| 10 | 12 | .IR lines ] |
|
| 11 | 13 | .RB [ \-p |
|
| 12 | 14 | .IR prompt ] |
|
| 48 | 50 | .TP |
|
| 49 | 51 | .BI \-l " lines" |
|
| 50 | 52 | dmenu lists items vertically, with the given number of lines. |
|
| 53 | + | .TP |
|
| 54 | + | .BI \-m " monitor" |
|
| 55 | + | dmenu is displayed on the monitor supplied. |
|
| 51 | 56 | .TP |
|
| 52 | 57 | .BI \-p " prompt" |
|
| 53 | 58 | defines the prompt to be displayed to the left of the input field. |
|
| 54 | 54 | static Item *prev, *curr, *next, *sel; |
|
| 55 | 55 | static Window win; |
|
| 56 | 56 | static XIC xic; |
|
| 57 | + | static int mon = -1; |
|
| 57 | 58 | ||
| 58 | 59 | #include "config.h" |
|
| 59 | 60 | ||
| 84 | 85 | /* these options take one argument */ |
|
| 85 | 86 | else if(!strcmp(argv[i], "-l")) /* number of lines in vertical list */ |
|
| 86 | 87 | lines = atoi(argv[++i]); |
|
| 88 | + | else if(!strcmp(argv[i], "-m")) |
|
| 89 | + | mon = atoi(argv[++i]); |
|
| 87 | 90 | else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ |
|
| 88 | 91 | prompt = argv[++i]; |
|
| 89 | 92 | else if(!strcmp(argv[i], "-fn")) /* font or font set */ |
|
| 557 | 560 | XWindowAttributes wa; |
|
| 558 | 561 | ||
| 559 | 562 | XGetInputFocus(dc->dpy, &w, &di); |
|
| 560 | - | if(w != root && w != PointerRoot && w != None) { |
|
| 563 | + | if(mon != -1 && mon < n) |
|
| 564 | + | i = mon; |
|
| 565 | + | if(!i && w != root && w != PointerRoot && w != None) { |
|
| 561 | 566 | /* find top-level window containing current input focus */ |
|
| 562 | 567 | do { |
|
| 563 | 568 | if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws) |
|
| 572 | 577 | } |
|
| 573 | 578 | } |
|
| 574 | 579 | /* no focused window is on screen, so use pointer location instead */ |
|
| 575 | - | if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) |
|
| 580 | + | if(mon == -1 && !area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) |
|
| 576 | 581 | for(i = 0; i < n; i++) |
|
| 577 | 582 | if(INTERSECT(x, y, 1, 1, info[i])) |
|
| 578 | 583 | break; |
|
| 614 | 619 | ||
| 615 | 620 | void |
|
| 616 | 621 | usage(void) { |
|
| 617 | - | fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]\n" |
|
| 622 | + | fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" |
|
| 618 | 623 | " [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr); |
|
| 619 | 624 | exit(EXIT_FAILURE); |
|
| 620 | 625 | } |
|