[wiki] [sites] add that monitor argument patch I've mentioned before to dwm/dmenu patches || mar77i

From: <git_AT_suckless.org>
Date: Sun, 09 Dec 2012 15:40:13 +0100

commit ca764531bd591c9c781368e195775b5cb6be472b
Author: mar77i <mysatyre_AT_gmail.com>
Date: Sun Dec 9 15:40:09 2012 +0100

    add that monitor argument patch I've mentioned before to dwm/dmenu patches

diff --git a/dwm.suckless.org/patches/dwm-6.1-monarg.diff b/dwm.suckless.org/patches/dwm-6.1-monarg.diff
new file mode 100644
index 0000000..53271c8
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.1-monarg.diff
_AT_@ -0,0 +1,30 @@
+diff --git a/dwm.c b/dwm.c
+index d9443da..28528ed 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -176,6 +176,7 @@ static void destroynotify(XEvent *e);
+ static void detach(Client *c);
+ static void detachstack(Client *c);
+ static Monitor *dirtomon(int dir);
++static void dmenuspawn(const Arg *arg);
+ static void drawbar(Monitor *m);
+ static void drawbars(void);
+ static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
+_AT_@ -709,6 +710,17 @@ dirtomon(int dir) {
+ }
+
+ void
++dmenuspawn(const Arg *arg) {
++ char monstr[2] = "0";
++ const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-m", monstr, "-nb",
++ normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf",
++ selfgcolor, NULL };
++ Arg a = { .v = dmenucmd };
++ monstr[0] = '0' + selmon->num;
++ spawn(&a);
++}
++
++void
+ drawbar(Monitor *m) {
+ int x;
+ unsigned int i, occ = 0, urg = 0;
diff --git a/dwm.suckless.org/patches/monarg.md b/dwm.suckless.org/patches/monarg.md
new file mode 100644
index 0000000..7d6e6b1
--- /dev/null
+++ b/dwm.suckless.org/patches/monarg.md
_AT_@ -0,0 +1,18 @@
+Monitor by Argument for dmenu
+=============================
+
+Description
+-----------
+
+Since dmenu was made to accept additional command line argument with
+[dmenu-4.5-monarg.diff](http://tools.suckless.org/dmenu/patches/monarg) to
+specify the monitor where dmenu is to be started. Works well with my monarg
+patch for dwm.
+
+Download
+--------
+* [dwm-6.1-monarg.diff](dwm-6.1-monarg.diff)
+
+Author
+------
+* mar77i <mysatyre at gmail dot com>
diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.5-monarg.diff b/tools.suckless.org/dmenu/patches/dmenu-4.5-monarg.diff
new file mode 100644
index 0000000..cab6d37
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-4.5-monarg.diff
_AT_@ -0,0 +1,101 @@
+diff --git a/dmenu.1 b/dmenu.1
+index 0784cd9..a0b488b 100644
+--- a/dmenu.1
++++ b/dmenu.1
+_AT_@ -12,6 +12,8 @@ dmenu \- dynamic menu
+ .IR prompt ]
+ .RB [ \-fn
+ .IR font ]
++.RB [ \-m
++.IR monitor ]
+ .RB [ \-nb
+ .IR color ]
+ .RB [ \-nf
+_AT_@ -55,6 +57,9 @@ defines the prompt to be displayed to the left of the input field.
+ .BI \-fn " font"
+ defines the font or font set used.
+ .TP
++.BI \-m " monitor"
++defines what monitor to run dmenu on.
++.TP
+ .BI \-nb " color"
+ defines the normal background color.
+ .IR #RGB ,
+diff --git a/dmenu.c b/dmenu.c
+index 4ea95f8..fb2f096 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -60,6 +60,7 @@ static Item *matches, *matchend;
+ static Item *prev, *curr, *next, *sel;
+ static Window win;
+ static XIC xic;
++static int mon = -1;
+
+ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
+ static char *(*fstrstr)(const char *, const char *) = strstr;
+_AT_@ -90,6 +91,8 @@ main(int argc, char *argv[]) {
+ lines = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
+ prompt = argv[++i];
++ else if(!strcmp(argv[i], "-m")) /* monitor index */
++ mon = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-fn")) /* font or font set */
+ font = argv[++i];
+ else if(!strcmp(argv[i], "-nb")) /* normal background color */
+_AT_@ -544,25 +547,29 @@ setup(void) {
+ XWindowAttributes wa;
+
+ XGetInputFocus(dc->dpy, &w, &di);
+- if(w != root && w != PointerRoot && w != None) {
+- /* find top-level window containing current input focus */
+- do {
+- if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws)
+- XFree(dws);
+- } while(w != root && w != pw);
+- /* find xinerama screen with which the window intersects most */
+- if(XGetWindowAttributes(dc->dpy, pw, &wa))
+- for(j = 0; j < n; j++)
+- if((a = INTERSECT(wa.x, wa.y, wa.width, wa.height, info[j])) > area) {
+- area = a;
+- i = j;
+- }
++ if(mon > -1 && mon < n)
++ i = mon;
++ else {
++ if(w != root && w != PointerRoot && w != None) {
++ /* find top-level window containing current input focus */
++ do {
++ if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws)
++ XFree(dws);
++ } while(w != root && w != pw);
++ /* find xinerama screen with which the window intersects most */
++ if(XGetWindowAttributes(dc->dpy, pw, &wa))
++ for(j = 0; j < n; j++)
++ if((a = INTERSECT(wa.x, wa.y, wa.width, wa.height, info[j])) > area) {
++ area = a;
++ i = j;
++ }
++ }
++ /* no focused window is on screen, so use pointer location instead */
++ if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
++ for(i = 0; i < n; i++)
++ if(INTERSECT(x, y, 1, 1, info[i]))
++ break;
+ }
+- /* no focused window is on screen, so use pointer location instead */
+- if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
+- for(i = 0; i < n; i++)
+- if(INTERSECT(x, y, 1, 1, info[i]))
+- break;
+
+ x = info[i].x_org;
+ y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
+_AT_@ -601,7 +608,7 @@ setup(void) {
+
+ void
+ usage(void) {
+- fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]
"
++ fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-v]
", stderr);
+ exit(EXIT_FAILURE);
+ }
diff --git a/tools.suckless.org/dmenu/patches/monarg.md b/tools.suckless.org/dmenu/patches/monarg.md
new file mode 100644
index 0000000..e967fa4
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/monarg.md
_AT_@ -0,0 +1,17 @@
+Monitor by Argument
+===================
+
+Description
+-----------
+
+Accept an additional command line argument to specify the monitor where dmenu
+is to be started. Works well with
+[dwm-6.1-monarg.diff](http://dwm.suckless.org/patches/monarg).
+
+Download
+--------
+* [dmenu-4.5-monarg.diff](dmenu-4.5-monarg.diff)
+
+Author
+------
+* mar77i <mysatyre at gmail dot com>
Received on Sun Dec 09 2012 - 15:40:13 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 09 2012 - 15:48:06 CET