Compare commits
No commits in common. "0023d6c2cd3d30515f9163568b88e252684b6b8a" and "07314a14de7d09c1c308ee36db5bde3d01e62ed1" have entirely different histories.
0023d6c2cd
...
07314a14de
|
@ -2,7 +2,7 @@
|
||||||
/* Default settings; can be overriden by command line. */
|
/* Default settings; can be overriden by command line. */
|
||||||
|
|
||||||
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
static const unsigned int alpha = 0x0b;
|
static const unsigned int alpha = 0xf0;
|
||||||
static const int border_width = 0; /* for alpha patch */
|
static const int border_width = 0; /* for alpha patch */
|
||||||
static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */
|
static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */
|
||||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
|
@ -25,9 +25,8 @@ static const unsigned int alphas[SchemeLast][2] = {
|
||||||
[SchemeOut] = { OPAQUE, alpha },
|
[SchemeOut] = { OPAQUE, alpha },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -l and -g options; controls number of lines and columns in grid if > 0 */
|
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
||||||
static unsigned int lines = 0;
|
static unsigned int lines = 0;
|
||||||
static unsigned int columns = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Characters not considered part of a word while deleting words
|
* Characters not considered part of a word while deleting words
|
||||||
|
|
7
dmenu.1
7
dmenu.1
|
@ -4,8 +4,6 @@ dmenu \- dynamic menu
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B dmenu
|
.B dmenu
|
||||||
.RB [ \-bfiv ]
|
.RB [ \-bfiv ]
|
||||||
.RB [ \-g
|
|
||||||
.IR columns ]
|
|
||||||
.RB [ \-l
|
.RB [ \-l
|
||||||
.IR lines ]
|
.IR lines ]
|
||||||
.RB [ \-m
|
.RB [ \-m
|
||||||
|
@ -57,11 +55,8 @@ is faster, but will lock up X until stdin reaches end\-of\-file.
|
||||||
.B \-i
|
.B \-i
|
||||||
dmenu matches menu items case insensitively.
|
dmenu matches menu items case insensitively.
|
||||||
.TP
|
.TP
|
||||||
.BI \-g " columns"
|
|
||||||
dmenu lists items in a grid with the given number of columns.
|
|
||||||
.TP
|
|
||||||
.BI \-l " lines"
|
.BI \-l " lines"
|
||||||
dmenu lists items in a grid with the given number of lines.
|
dmenu lists items vertically, with the given number of lines.
|
||||||
.TP
|
.TP
|
||||||
.BI \-m " monitor"
|
.BI \-m " monitor"
|
||||||
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
|
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
|
||||||
|
|
32
dmenu.c
32
dmenu.c
|
@ -90,7 +90,7 @@ calcoffsets(void)
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
if (lines > 0)
|
if (lines > 0)
|
||||||
n = lines * columns * bh;
|
n = lines * bh;
|
||||||
else
|
else
|
||||||
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
|
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
|
||||||
/* calculate which items will begin the next page and previous page */
|
/* calculate which items will begin the next page and previous page */
|
||||||
|
@ -207,15 +207,9 @@ drawmenu(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines > 0) {
|
if (lines > 0) {
|
||||||
/* draw grid */
|
/* draw vertical list */
|
||||||
int i = 0;
|
for (item = curr; item != next; item = item->right)
|
||||||
for (item = curr; item != next; item = item->right, i++)
|
drawitem(item, x, y += bh, mw - x);
|
||||||
drawitem(
|
|
||||||
item,
|
|
||||||
x + ((i / lines) * ((mw - x) / columns)),
|
|
||||||
y + (((i % lines) + 1) * bh),
|
|
||||||
(mw - x) / columns
|
|
||||||
);
|
|
||||||
} else if (matches) {
|
} else if (matches) {
|
||||||
/* draw horizontal list */
|
/* draw horizontal list */
|
||||||
x += inputw;
|
x += inputw;
|
||||||
|
@ -757,7 +751,6 @@ setup(void)
|
||||||
bh = drw->fonts->h + 2;
|
bh = drw->fonts->h + 2;
|
||||||
lines = MAX(lines, 0);
|
lines = MAX(lines, 0);
|
||||||
mh = (lines + 1) * bh;
|
mh = (lines + 1) * bh;
|
||||||
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
i = 0;
|
i = 0;
|
||||||
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
|
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
|
||||||
|
@ -784,9 +777,9 @@ setup(void)
|
||||||
if (INTERSECT(x, y, 1, 1, info[i]))
|
if (INTERSECT(x, y, 1, 1, info[i]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
x = info[i].x_org;
|
||||||
|
y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
|
||||||
mw = info[i].width;
|
mw = info[i].width;
|
||||||
x = info[i].x_org + ((info[i].width - mw) / 2);
|
|
||||||
y = info[i].y_org + ((info[i].height - mh) / 2);
|
|
||||||
XFree(info);
|
XFree(info);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
@ -794,10 +787,11 @@ setup(void)
|
||||||
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
||||||
die("could not get embedding window attributes: 0x%lx",
|
die("could not get embedding window attributes: 0x%lx",
|
||||||
parentwin);
|
parentwin);
|
||||||
|
x = 0;
|
||||||
|
y = topbar ? 0 : wa.height - mh;
|
||||||
mw = wa.width;
|
mw = wa.width;
|
||||||
x = (wa.width - mw) / 2;
|
|
||||||
y = (wa.height - mh) / 2;
|
|
||||||
}
|
}
|
||||||
|
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
|
||||||
inputw = MIN(inputw, mw/3);
|
inputw = MIN(inputw, mw/3);
|
||||||
match();
|
match();
|
||||||
|
|
||||||
|
@ -866,13 +860,9 @@ main(int argc, char *argv[])
|
||||||
} else if (i + 1 == argc)
|
} else if (i + 1 == argc)
|
||||||
usage();
|
usage();
|
||||||
/* these options take one argument */
|
/* these options take one argument */
|
||||||
else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */
|
else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
|
||||||
columns = atoi(argv[++i]);
|
|
||||||
if (lines == 0) lines = 1;
|
|
||||||
} else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */
|
|
||||||
lines = atoi(argv[++i]);
|
lines = atoi(argv[++i]);
|
||||||
if (columns == 0) columns = 1;
|
else if (!strcmp(argv[i], "-m"))
|
||||||
} else if (!strcmp(argv[i], "-m"))
|
|
||||||
mon = atoi(argv[++i]);
|
mon = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
|
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
|
||||||
prompt = argv[++i];
|
prompt = argv[++i];
|
||||||
|
|
Loading…
Reference in New Issue