diff options
Diffstat (limited to 'dmenu')
-rw-r--r-- | dmenu/config.h | 23 | ||||
-rw-r--r-- | dmenu/patches/dmenu-center-4.8.diff | 56 |
2 files changed, 79 insertions, 0 deletions
diff --git a/dmenu/config.h b/dmenu/config.h new file mode 100644 index 0000000..091780e --- /dev/null +++ b/dmenu/config.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* See LICENSE file for copyright and license details. */ | ||
2 | /* Default settings; can be overriden by command line. */ | ||
3 | |||
4 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ | ||
5 | /* -fn option overrides fonts[0]; default X11 font or font set */ | ||
6 | static const char *fonts[] = { | ||
7 | "Hermit:size=10" | ||
8 | }; | ||
9 | static const char *prompt = NULL; /* -p option; prompt to the left of input field */ | ||
10 | static const char *colors[SchemeLast][2] = { | ||
11 | /* fg bg */ | ||
12 | [SchemeNorm] = { "#bbbbbb", "#222222" }, | ||
13 | [SchemeSel] = { "#eeeeee", "#005577" }, | ||
14 | [SchemeOut] = { "#000000", "#00ffff" }, | ||
15 | }; | ||
16 | /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ | ||
17 | static unsigned int lines = 0; | ||
18 | |||
19 | /* | ||
20 | * Characters not considered part of a word while deleting words | ||
21 | * for example: " /?\"&[]" | ||
22 | */ | ||
23 | static const char worddelimiters[] = " "; | ||
diff --git a/dmenu/patches/dmenu-center-4.8.diff b/dmenu/patches/dmenu-center-4.8.diff new file mode 100644 index 0000000..a970fcb --- /dev/null +++ b/dmenu/patches/dmenu-center-4.8.diff | |||
@@ -0,0 +1,56 @@ | |||
1 | diff --git a/dmenu.c b/dmenu.c | ||
2 | index 5e9c367..2268ea9 100644 | ||
3 | --- a/dmenu.c | ||
4 | +++ b/dmenu.c | ||
5 | @@ -88,6 +88,15 @@ calcoffsets(void) | ||
6 | break; | ||
7 | } | ||
8 | |||
9 | +static int | ||
10 | +max_textw(void) | ||
11 | +{ | ||
12 | + int len = 0; | ||
13 | + for (struct item *item = items; item && item->text; item++) | ||
14 | + len = MAX(TEXTW(item->text), len); | ||
15 | + return len; | ||
16 | +} | ||
17 | + | ||
18 | static void | ||
19 | cleanup(void) | ||
20 | { | ||
21 | @@ -598,6 +607,7 @@ setup(void) | ||
22 | bh = drw->fonts->h + 2; | ||
23 | lines = MAX(lines, 0); | ||
24 | mh = (lines + 1) * bh; | ||
25 | + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; | ||
26 | #ifdef XINERAMA | ||
27 | i = 0; | ||
28 | if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { | ||
29 | @@ -624,9 +634,9 @@ setup(void) | ||
30 | if (INTERSECT(x, y, 1, 1, info[i])) | ||
31 | break; | ||
32 | |||
33 | - x = info[i].x_org; | ||
34 | - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); | ||
35 | - mw = info[i].width; | ||
36 | + mw = MIN(MAX(max_textw() + promptw, 100), info[i].width); | ||
37 | + x = info[i].x_org + ((info[i].width - mw) / 2); | ||
38 | + y = info[i].y_org + ((info[i].height - mh) / 2); | ||
39 | XFree(info); | ||
40 | } else | ||
41 | #endif | ||
42 | @@ -634,11 +644,10 @@ setup(void) | ||
43 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) | ||
44 | die("could not get embedding window attributes: 0x%lx", | ||
45 | parentwin); | ||
46 | - x = 0; | ||
47 | - y = topbar ? 0 : wa.height - mh; | ||
48 | - mw = wa.width; | ||
49 | + mw = MIN(MAX(max_textw() + promptw, 100), wa.width); | ||
50 | + x = (wa.width - mw) / 2; | ||
51 | + y = (wa.height - mh) / 2; | ||
52 | } | ||
53 | - promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; | ||
54 | inputw = MIN(inputw, mw/3); | ||
55 | match(); | ||
56 | |||