diff options
Diffstat (limited to 'dmenu.c')
| -rw-r--r-- | dmenu.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -47,6 +47,9 @@ typedef struct { static char text[BUFSIZ] = ""; static char *embed; static int bh, mw, mh; +static int dmx = 0; /* put dmenu at this x offset */ +static int dmy = 0; /* put dmenu at this y offset (measured from the bottom if topbar is 0) */ +static unsigned int dmw = 0; /* make dmenu this wide */ static int inputw = 0, promptw; static int lrpad; /* sum of left and right padding */ static size_t cursor; @@ -1058,9 +1061,9 @@ setup(void) x = info[i].x_org + ((info[i].width - mw) / 2); y = info[i].y_org + ((info[i].height - mh) / menu_height_ratio); } else { - x = info[i].x_org; - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); - mw = info[i].width; + x = info[i].x_org + dmx; + y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy); + mw = (dmw>0 ? dmw : info[i].width);; } XFree(info); @@ -1076,9 +1079,9 @@ setup(void) x = (wa.width - mw) / 2; y = (wa.height - mh) / 2; } else { - x = 0; - y = topbar ? 0 : wa.height - mh; - mw = wa.width; + x = dmx; + y = topbar ? dmy : wa.height - mh - dmy; + mw = (dmw>0 ? dmw : wa.width); } } promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; @@ -1124,6 +1127,7 @@ usage(void) { die("usage: dmenu [-bfiv] [-noi] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n" + " [-x xoffset] [-y yoffset] [-z width]\n" " [-it text]\n", stderr); } @@ -1186,6 +1190,12 @@ main(int argc, char *argv[]) colors[SchemeOut][ColFg] = argv[++i]; else if (!strcmp(argv[i], "-w")) /* embedding window id */ embed = argv[++i]; + else if (!strcmp(argv[i], "-x")) /* window x offset */ + dmx = atoi(argv[++i]); + else if (!strcmp(argv[i], "-y")) /* window y offset (from bottom up if -b) */ + dmy = atoi(argv[++i]); + else if (!strcmp(argv[i], "-z")) /* make dmenu this wide */ + dmw = atoi(argv[++i]); else if (!strcmp(argv[i], "-bw")) border_width = atoi(argv[++i]); /* border width */ else if (!strcmp(argv[i], "-it")) { /* embedding window id */ |
