diff -r b491483be453 dmenu.c
--- a/dmenu.c	Mon Jul 30 17:02:12 2012 +0200
+++ b/dmenu.c	Mon Oct 08 13:06:52 2012 +0700
@@ -54,6 +54,7 @@
 static unsigned long selcol[ColLast];
 static Atom clip, utf8;
 static Bool topbar = True;
+static Bool mousefocus = False;
 static DC *dc;
 static Item *items = NULL;
 static Item *matches, *matchend;
@@ -77,6 +78,8 @@
 		}
 		else if(!strcmp(argv[i], "-b"))   /* appears at the bottom of the screen */
 			topbar = False;
+		else if(!strcmp(argv[i], "-m"))   /* force focus to be grabbed from mouse pos */
+			mousefocus = True;
 		else if(!strcmp(argv[i], "-f"))   /* grabs keyboard before reading stdin */
 			fast = True;
 		else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
@@ -562,7 +565,7 @@
 					}
 		}
 		/* no focused window is on screen, so use pointer location instead */
-		if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
+		if((mousefocus || !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;
