summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/dmenu-caseinsensitive-5.0.diff53
-rw-r--r--patches/dmenu-emoji-highlight-5.0.diff297
-rw-r--r--patches/dmenu-mousesupport-5.1.diff (renamed from patches/dmenu-mousesupport-5.0.diff)8
-rw-r--r--patches/dmenu-mousesupporthoverbgcol-5.0.diff184
-rw-r--r--patches/dmenu-separator-20210904-d78ff08.diff28
-rw-r--r--patches/dmenu-xresources-4.9.diff.1126
6 files changed, 201 insertions, 495 deletions
diff --git a/patches/dmenu-caseinsensitive-5.0.diff b/patches/dmenu-caseinsensitive-5.0.diff
deleted file mode 100644
index f476bc9..0000000
--- a/patches/dmenu-caseinsensitive-5.0.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-diff --git a/dmenu.1 b/dmenu.1
-index 323f93c..3e3b31b 100644
---- a/dmenu.1
-+++ b/dmenu.1
-@@ -3,7 +3,7 @@
- dmenu \- dynamic menu
- .SH SYNOPSIS
- .B dmenu
--.RB [ \-bfiv ]
-+.RB [ \-bfsv ]
- .RB [ \-l
- .IR lines ]
- .RB [ \-m
-@@ -44,8 +44,8 @@ dmenu appears at the bottom of the screen.
- dmenu grabs the keyboard before reading stdin if not reading from a tty. This
- is faster, but will lock up X until stdin reaches end\-of\-file.
- .TP
--.B \-i
--dmenu matches menu items case insensitively.
-+.B \-s
-+dmenu matches menu items case sensitively.
- .TP
- .BI \-l " lines"
- dmenu lists items vertically, with the given number of lines.
-diff --git a/dmenu.c b/dmenu.c
-index 65f25ce..855df59 100644
---- a/dmenu.c
-+++ b/dmenu.c
-@@ -55,8 +55,9 @@ static Clr *scheme[SchemeLast];
-
- #include "config.h"
-
--static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
--static char *(*fstrstr)(const char *, const char *) = strstr;
-+static char * cistrstr(const char *s, const char *sub);
-+static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp;
-+static char *(*fstrstr)(const char *, const char *) = cistrstr;
-
- static void
- appenditem(struct item *item, struct item **list, struct item **last)
-@@ -709,9 +710,9 @@ main(int argc, char *argv[])
- topbar = 0;
- else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
- fast = 1;
-- else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
-- fstrncmp = strncasecmp;
-- fstrstr = cistrstr;
-+ else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
-+ fstrncmp = strncmp;
-+ fstrstr = strstr;
- } else if (i + 1 == argc)
- usage();
- /* these options take one argument */
diff --git a/patches/dmenu-emoji-highlight-5.0.diff b/patches/dmenu-emoji-highlight-5.0.diff
deleted file mode 100644
index c52326b..0000000
--- a/patches/dmenu-emoji-highlight-5.0.diff
+++ /dev/null
@@ -1,297 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index 1edb647..ed3b175 100644
---- a/config.def.h
-+++ b/config.def.h
-@@ -4,18 +4,33 @@
- static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
- /* -fn option overrides fonts[0]; default X11 font or font set */
- static const char *fonts[] = {
-- "monospace:size=10"
-+ "monospace:size=10",
-+ "FiraCode Nerd Font:size=12",
- };
-+
- static const char *prompt = NULL; /* -p option; prompt to the left of input field */
--static const char *colors[SchemeLast][2] = {
-- /* fg bg */
-- [SchemeNorm] = { "#bbbbbb", "#222222" },
-- [SchemeSel] = { "#eeeeee", "#005577" },
-- [SchemeOut] = { "#000000", "#00ffff" },
-+static const char *colors[SchemeLast][10] = {
-+ /* fg bg */
-+ [SchemeNorm] = { "#bbbbbb", "#222222", "#222222" },
-+ [SchemeSel] = { "#eeeeee", "#005577", "#005577" },
-+ [SchemeOut] = { "#000000", "#00ffff", "#00ffff" },
-+ [SchemeHighlight] = {"#f1fa8c", "#596377", "#3E485B"},
-+ [SchemeHover] = {"#ffffff", "#353D4B", "#3E485B"},
-+ [SchemeGreen] = {"#ffffff", "#52E067", "#41b252"},
-+ [SchemeRed] = {"#ffffff", "#e05252", "#c24343"},
-+ [SchemeYellow] = {"#ffffff", "#e0c452", "#bca33f"},
-+ [SchemeBlue] = {"#ffffff", "#5280e0", "#3a62b3"},
-+ [SchemePurple] = {"#ffffff", "#9952e0", "#7439b0"},
- };
- /* -l option; if nonzero, dmenu uses vertical list with given number of lines */
- static unsigned int lines = 0;
-
-+static unsigned int lineheight = 0; /* -h option; minimum height of a menu line */
-+static unsigned int min_lineheight = 8;
-+static int sely = 0;
-+static int commented = 0;
-+static int animated = 0;
-+
- /*
- * Characters not considered part of a word while deleting words
- * for example: " /?\"&[]"
-diff --git a/dmenu.c b/dmenu.c
-index 65f25ce..a558fcb 100644
---- a/dmenu.c
-+++ b/dmenu.c
-@@ -26,7 +26,20 @@
- #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
-
- /* enums */
--enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
-+enum {
-+ SchemeNorm,
-+ SchemeFade,
-+ SchemeHighlight,
-+ SchemeHover,
-+ SchemeSel,
-+ SchemeOut,
-+ SchemeGreen,
-+ SchemeYellow,
-+ SchemeBlue,
-+ SchemePurple,
-+ SchemeRed,
-+ SchemeLast
-+}; /* color schemes */
-
- struct item {
- char *text;
-@@ -37,6 +50,9 @@ struct item {
- 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;
-@@ -114,16 +130,117 @@ cistrstr(const char *s, const char *sub)
- }
-
- static int
--drawitem(struct item *item, int x, int y, int w)
--{
-- if (item == sel)
-- drw_setscheme(drw, scheme[SchemeSel]);
-- else if (item->out)
-- drw_setscheme(drw, scheme[SchemeOut]);
-- else
-- drw_setscheme(drw, scheme[SchemeNorm]);
--
-- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
-+drawitem(struct item *item, int x, int y, int w) {
-+ int iscomment = 0;
-+ if (item->text[0] == '>') {
-+ if (item->text[1] == '>') {
-+ iscomment = 3;
-+ switch (item->text[2]) {
-+ case 'r':
-+ drw_setscheme(drw, scheme[SchemeRed]);
-+ break;
-+ case 'g':
-+ drw_setscheme(drw, scheme[SchemeGreen]);
-+ break;
-+ case 'y':
-+ drw_setscheme(drw, scheme[SchemeYellow]);
-+ break;
-+ case 'b':
-+ drw_setscheme(drw, scheme[SchemeBlue]);
-+ break;
-+ case 'p':
-+ drw_setscheme(drw, scheme[SchemePurple]);
-+ break;
-+ case 'h':
-+ drw_setscheme(drw, scheme[SchemeHighlight]);
-+ break;
-+ case 's':
-+ drw_setscheme(drw, scheme[SchemeSel]);
-+ break;
-+ default:
-+ iscomment = 1;
-+ drw_setscheme(drw, scheme[SchemeNorm]);
-+ break;
-+ }
-+ } else {
-+ drw_setscheme(drw, scheme[SchemeNorm]);
-+ iscomment = 1;
-+ }
-+
-+ } else if (item->text[0] == ':') {
-+ iscomment = 2;
-+ if (item == sel) {
-+ switch (item->text[1]) {
-+ case 'r':
-+ drw_setscheme(drw, scheme[SchemeRed]);
-+ break;
-+ case 'g':
-+ drw_setscheme(drw, scheme[SchemeGreen]);
-+ break;
-+ case 'y':
-+ drw_setscheme(drw, scheme[SchemeYellow]);
-+ break;
-+ case 'b':
-+ drw_setscheme(drw, scheme[SchemeBlue]);
-+ break;
-+ case 'p':
-+ drw_setscheme(drw, scheme[SchemePurple]);
-+ break;
-+ case 'h':
-+ drw_setscheme(drw, scheme[SchemeHighlight]);
-+ break;
-+ case 's':
-+ drw_setscheme(drw, scheme[SchemeSel]);
-+ break;
-+ default:
-+ drw_setscheme(drw, scheme[SchemeSel]);
-+ iscomment = 0;
-+ break;
-+ }
-+ } else {
-+ drw_setscheme(drw, scheme[SchemeNorm]);
-+ }
-+ } else {
-+ if (item == sel)
-+ drw_setscheme(drw, scheme[SchemeSel]);
-+ else if (item->out)
-+ drw_setscheme(drw, scheme[SchemeOut]);
-+ else
-+ drw_setscheme(drw, scheme[SchemeNorm]);
-+ }
-+
-+ int temppadding;
-+ temppadding = 0;
-+ if (iscomment == 2) {
-+ if (item->text[2] == ' ') {
-+ temppadding = drw->fonts->h * 3;
-+ animated = 1;
-+ char dest[1000];
-+ strcpy(dest, item->text);
-+ dest[6] = '\0';
-+ drw_text(drw, x, y, temppadding, lineheight, temppadding / 2.6, dest + 3, 0);
-+ iscomment = 6;
-+ drw_setscheme(drw, sel == item ? scheme[SchemeHover] : scheme[SchemeNorm]);
-+ }
-+ }
-+
-+ char *output;
-+ if (commented) {
-+ static char onestr[2];
-+ onestr[0] = item->text[0];
-+ onestr[1] = '\0';
-+ output = onestr;
-+ } else {
-+ output = item->text;
-+ }
-+
-+ if (item == sel)
-+ sely = y;
-+ return drw_text(
-+ drw, x + ((iscomment == 6) ? temppadding : 0), y,
-+ commented ? bh : (w - ((iscomment == 6) ? temppadding : 0)), bh,
-+ commented ? (bh - drw_fontset_getwidth(drw, (output))) / 2 : lrpad / 2,
-+ output + iscomment, 0);
- }
-
- static void
-@@ -131,7 +248,7 @@ drawmenu(void)
- {
- unsigned int curpos;
- struct item *item;
-- int x = 0, y = 0, w;
-+ int x = 0, y = 0, fh = drw->fonts->h, w;
-
- drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, 0, 0, mw, mh, 1, 1);
-@@ -148,7 +265,7 @@ drawmenu(void)
- curpos = TEXTW(text) - TEXTW(&text[cursor]);
- if ((curpos += lrpad / 2 - 1) < w) {
- drw_setscheme(drw, scheme[SchemeNorm]);
-- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
-+ drw_rect(drw, x + curpos, 2 + (bh - fh) / 2, 2, fh - 4, 1, 0);
- }
-
- if (lines > 0) {
-@@ -609,6 +726,7 @@ setup(void)
-
- /* calculate menu geometry */
- bh = drw->fonts->h + 2;
-+ bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */
- lines = MAX(lines, 0);
- mh = (lines + 1) * bh;
- #ifdef XINERAMA
-@@ -637,9 +755,9 @@ setup(void)
- 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);
-- 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);
- } else
- #endif
-@@ -647,9 +765,9 @@ setup(void)
- if (!XGetWindowAttributes(dpy, parentwin, &wa))
- die("could not get embedding window attributes: 0x%lx",
- parentwin);
-- 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;
- inputw = MIN(inputw, mw/3);
-@@ -689,7 +807,8 @@ setup(void)
- static void
- usage(void)
- {
-- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
-+ fputs("usage: dmenu [-bfiv] [-l lines] [-h height] [-p prompt] [-fn font] [-m monitor]\n"
-+ " [-x xoffset] [-y yoffset] [-z width]\n"
- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
- exit(1);
- }
-@@ -717,6 +836,16 @@ main(int argc, char *argv[])
- /* these options take one argument */
- else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
- lines = atoi(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], "-h")) { /* minimum height of one menu line */
-+ lineheight = atoi(argv[++i]);
-+ lineheight = MAX(lineheight, min_lineheight);
-+ }
- else if (!strcmp(argv[i], "-m"))
- mon = atoi(argv[++i]);
- else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
-@@ -752,6 +881,9 @@ main(int argc, char *argv[])
- die("no fonts could be loaded.");
- lrpad = drw->fonts->h;
-
-+ if (lineheight == -1)
-+ lineheight = drw->fonts->h * 2.5;
-+
- #ifdef __OpenBSD__
- if (pledge("stdio rpath", NULL) == -1)
- die("pledge");
diff --git a/patches/dmenu-mousesupport-5.0.diff b/patches/dmenu-mousesupport-5.1.diff
index 6a8c4d4..49824ba 100644
--- a/patches/dmenu-mousesupport-5.0.diff
+++ b/patches/dmenu-mousesupport-5.1.diff
@@ -1,8 +1,8 @@
diff --git a/dmenu.c b/dmenu.c
-index 65f25ce..dfa59db 100644
+index d95e6c6..75a79d0 100644
--- a/dmenu.c
+++ b/dmenu.c
-@@ -500,6 +500,119 @@ draw:
+@@ -518,6 +518,119 @@ draw:
drawmenu();
}
@@ -122,7 +122,7 @@ index 65f25ce..dfa59db 100644
static void
paste(void)
{
-@@ -561,6 +674,9 @@ run(void)
+@@ -579,6 +692,9 @@ run(void)
break;
cleanup();
exit(1);
@@ -132,7 +132,7 @@ index 65f25ce..dfa59db 100644
case Expose:
if (ev.xexpose.count == 0)
drw_map(drw, win, 0, 0, mw, mh);
-@@ -658,7 +774,8 @@ setup(void)
+@@ -676,7 +792,8 @@ setup(void)
/* create menu window */
swa.override_redirect = True;
swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
diff --git a/patches/dmenu-mousesupporthoverbgcol-5.0.diff b/patches/dmenu-mousesupporthoverbgcol-5.0.diff
new file mode 100644
index 0000000..1fb7d41
--- /dev/null
+++ b/patches/dmenu-mousesupporthoverbgcol-5.0.diff
@@ -0,0 +1,184 @@
+Only in .: config.h
+diff -up ../dmenu-5.0/dmenu.c ./dmenu.c
+--- ../dmenu-5.0/dmenu.c Wed Sep 2 18:37:07 2020
++++ ./dmenu.c Wed Nov 4 15:25:27 2020
+@@ -501,6 +501,156 @@ draw:
+ }
+
+ static void
++buttonpress(XEvent *e)
++{
++ struct item *item;
++ XButtonPressedEvent *ev = &e->xbutton;
++ int x = 0, y = 0, h = bh, w;
++
++ if (ev->window != win)
++ return;
++
++ /* right-click: exit */
++ if (ev->button == Button3)
++ exit(1);
++
++ if (prompt && *prompt)
++ x += promptw;
++
++ /* input field */
++ w = (lines > 0 || !matches) ? mw - x : inputw;
++
++ /* left-click on input: clear input,
++ * NOTE: if there is no left-arrow the space for < is reserved so
++ * add that to the input width */
++ if (ev->button == Button1 &&
++ ((lines <= 0 && ev->x >= 0 && ev->x <= x + w +
++ ((!prev || !curr->left) ? TEXTW("<") : 0)) ||
++ (lines > 0 && ev->y >= y && ev->y <= y + h))) {
++ insert(NULL, -cursor);
++ drawmenu();
++ return;
++ }
++ /* middle-mouse click: paste selection */
++ if (ev->button == Button2) {
++ XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
++ utf8, utf8, win, CurrentTime);
++ drawmenu();
++ return;
++ }
++ /* scroll up */
++ if (ev->button == Button4 && prev) {
++ sel = curr = prev;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ /* scroll down */
++ if (ev->button == Button5 && next) {
++ sel = curr = next;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ if (ev->button != Button1)
++ return;
++ /* disabled below, needs to be fixed */
++ /*
++ if (ev->state & ~ControlMask)
++ return;
++ */
++ if (lines > 0) {
++ /* vertical list: (ctrl)left-click on item */
++ w = mw - x;
++ for (item = curr; item != next; item = item->right) {
++ y += h;
++ if (ev->y >= y && ev->y <= (y + h)) {
++ puts(item->text);
++ if (!(ev->state & ControlMask))
++ exit(0);
++ sel = item;
++ if (sel) {
++ sel->out = 1;
++ drawmenu();
++ }
++ return;
++ }
++ }
++ } else if (matches) {
++ /* left-click on left arrow */
++ x += inputw;
++ w = TEXTW("<");
++ if (prev && curr->left) {
++ if (ev->x >= x && ev->x <= x + w) {
++ sel = curr = prev;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ }
++ /* horizontal list: (ctrl)left-click on item */
++ for (item = curr; item != next; item = item->right) {
++ x += w;
++ w = MIN(TEXTW(item->text), mw - x - TEXTW(">"));
++ if (ev->x >= x && ev->x <= x + w) {
++ puts(item->text);
++ if (!(ev->state & ControlMask))
++ exit(0);
++ sel = item;
++ if (sel) {
++ sel->out = 1;
++ drawmenu();
++ }
++ return;
++ }
++ }
++ /* left-click on right arrow */
++ w = TEXTW(">");
++ x = mw - w;
++ if (next && ev->x >= x && ev->x <= x + w) {
++ sel = curr = next;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ }
++}
++
++static void
++mousemove(XEvent *e)
++{
++ struct item *item;
++ XPointerMovedEvent *ev = &e->xmotion;
++ int x = 0, y = 0, h = bh, w;
++
++ if (lines > 0) {
++ w = mw - x;
++ for (item = curr; item != next; item = item->right) {
++ y += h;
++ if (ev->y >= y && ev->y <= (y + h)) {
++ sel = item;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ }
++ } else if (matches) {
++ x += inputw;
++ w = TEXTW("<");
++ for (item = curr; item != next; item = item->right) {
++ x += w;
++ w = MIN(TEXTW(item->text), mw - x - TEXTW(">"));
++ if (ev->x >= x && ev->x <= x + w) {
++ sel = item;
++ calcoffsets();
++ drawmenu();
++ return;
++ }
++ }
++ }
++}
++
++static void
+ paste(void)
+ {
+ char *p, *q;
+@@ -561,6 +711,12 @@ run(void)
+ break;
+ cleanup();
+ exit(1);
++ case ButtonPress:
++ buttonpress(&ev);
++ break;
++ case MotionNotify:
++ mousemove(&ev);
++ break;
+ case Expose:
+ if (ev.xexpose.count == 0)
+ drw_map(drw, win, 0, 0, mw, mh);
+@@ -658,7 +814,8 @@ setup(void)
+ /* create menu window */
+ swa.override_redirect = True;
+ swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+- swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask;
++ swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask |
++ ButtonPressMask | PointerMotionMask;
+ win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
diff --git a/patches/dmenu-separator-20210904-d78ff08.diff b/patches/dmenu-separator-20210904-d78ff08.diff
index 25e1fb3..be30420 100644
--- a/patches/dmenu-separator-20210904-d78ff08.diff
+++ b/patches/dmenu-separator-20210904-d78ff08.diff
@@ -1,5 +1,5 @@
diff --git a/dmenu.1 b/dmenu.1
-index f9e0db7..af3a6f5 100644
+index 323f93c..d511148 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -22,6 +22,10 @@ dmenu \- dynamic menu
@@ -13,7 +13,7 @@ index f9e0db7..af3a6f5 100644
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
-@@ -83,6 +87,14 @@ prints version information to stdout, then exits.
+@@ -80,6 +84,14 @@ prints version information to stdout, then exits.
.TP
.BI \-w " windowid"
embed into windowid.
@@ -29,7 +29,7 @@ index f9e0db7..af3a6f5 100644
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.
diff --git a/dmenu.c b/dmenu.c
-index 98507d9..2ac2c9a 100644
+index 98507d9..82227c8 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -30,12 +30,16 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
@@ -62,28 +62,26 @@ index 98507d9..2ac2c9a 100644
*p = '\0';
if (!(items[i].text = strdup(buf)))
die("cannot strdup %u bytes:", strlen(buf) + 1);
-+ if (separator && (p = (separator_greedy) ?
-+ strrchr(items[i].text, separator) : strchr(items[i].text, separator))) {
++ if (separator && (p = separator_greedy ?
++ strrchr(items[i].text, separator) : strchr(items[i].text, separator))) {
+ *p = '\0';
+ items[i].text_output = ++p;
+ } else {
+ items[i].text_output = items[i].text;
+ }
+ if (separator_reverse) {
-+ char *tmp = items[i].text;
++ p = items[i].text;
+ items[i].text = items[i].text_output;
-+ items[i].text_output = tmp;
++ items[i].text_output = p;
+ }
items[i].out = 0;
drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
if (tmpmax > inputw) {
-@@ -700,8 +716,9 @@ setup(void)
- static void
+@@ -701,7 +717,8 @@ static void
usage(void)
{
-- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
+ fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
-+ fputs("usage: dmenu [-bfinv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n"
+ " [-d separator] [-D separator]\n", stderr);
exit(1);
@@ -93,10 +91,10 @@ index 98507d9..2ac2c9a 100644
colors[SchemeSel][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
-+ else if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "-D")) { /* field separator */
-+ separator_reverse = (*(argv[i+1]+1) == '|');
-+ separator_greedy = !strcmp(argv[i], "-D");
-+ separator = *argv[++i];
++ else if (!strcmp(argv[i], "-d") || /* field separator */
++ (separator_greedy = !strcmp(argv[i], "-D"))) {
++ separator = argv[++i][0];
++ separator_reverse = argv[i][1] == '|';
+ }
else
usage();
diff --git a/patches/dmenu-xresources-4.9.diff.1 b/patches/dmenu-xresources-4.9.diff.1
deleted file mode 100644
index 267fb0a..0000000
--- a/patches/dmenu-xresources-4.9.diff.1
+++ /dev/null
@@ -1,126 +0,0 @@
-diff '--color=auto' -up ../dmenu-4.9/dmenu.c ./dmenu.c
---- ../dmenu-4.9/dmenu.c 2019-02-02 13:55:02.000000000 +0100
-+++ ./dmenu.c 2020-05-24 00:27:58.038586112 +0200
-@@ -15,6 +15,7 @@
- #include <X11/extensions/Xinerama.h>
- #endif
- #include <X11/Xft/Xft.h>
-+#include <X11/Xresource.h>
-
- #include "drw.h"
- #include "util.h"
-@@ -53,6 +54,10 @@ static XIC xic;
- static Drw *drw;
- static Clr *scheme[SchemeLast];
-
-+/* Temporary arrays to allow overriding xresources values */
-+static char *colortemp[4];
-+static char *tempfonts;
-+
- #include "config.h"
-
- static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
-@@ -596,8 +601,13 @@ setup(void)
- int a, di, n, area = 0;
- #endif
- /* init appearance */
-- for (j = 0; j < SchemeLast; j++)
-- scheme[j] = drw_scm_create(drw, colors[j], 2);
-+ for (j = 0; j < SchemeLast; j++) {
-+ scheme[j] = drw_scm_create(drw, (const char**)colors[j], 2);
-+ }
-+ for (j = 0; j < SchemeOut; ++j) {
-+ for (i = 0; i < 2; ++i)
-+ free(colors[j][i]);
-+ }
-
- clip = XInternAtom(dpy, "CLIPBOARD", False);
- utf8 = XInternAtom(dpy, "UTF8_STRING", False);
-@@ -687,6 +697,41 @@ usage(void)
- exit(1);
- }
-
-+void
-+readxresources(void) {
-+ XrmInitialize();
-+
-+ char* xrm;
-+ if ((xrm = XResourceManagerString(drw->dpy))) {
-+ char *type;
-+ XrmDatabase xdb = XrmGetStringDatabase(xrm);
-+ XrmValue xval;
-+
-+ if (XrmGetResource(xdb, "dmenu.font", "*", &type, &xval))
-+ fonts[0] = strdup(xval.addr);
-+ else
-+ fonts[0] = strdup(fonts[0]);
-+ if (XrmGetResource(xdb, "dmenu.background", "*", &type, &xval))
-+ colors[SchemeNorm][ColBg] = strdup(xval.addr);
-+ else
-+ colors[SchemeNorm][ColBg] = strdup(colors[SchemeNorm][ColBg]);
-+ if (XrmGetResource(xdb, "dmenu.foreground", "*", &type, &xval))
-+ colors[SchemeNorm][ColFg] = strdup(xval.addr);
-+ else
-+ colors[SchemeNorm][ColFg] = strdup(colors[SchemeNorm][ColFg]);
-+ if (XrmGetResource(xdb, "dmenu.selbackground", "*", &type, &xval))
-+ colors[SchemeSel][ColBg] = strdup(xval.addr);
-+ else
-+ colors[SchemeSel][ColBg] = strdup(colors[SchemeSel][ColBg]);
-+ if (XrmGetResource(xdb, "dmenu.selforeground", "*", &type, &xval))
-+ colors[SchemeSel][ColFg] = strdup(xval.addr);
-+ else
-+ colors[SchemeSel][ColFg] = strdup(colors[SchemeSel][ColFg]);
-+
-+ XrmDestroyDatabase(xdb);
-+ }
-+}
-+
- int
- main(int argc, char *argv[])
- {
-@@ -715,15 +760,15 @@ main(int argc, char *argv[])
- else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
- prompt = argv[++i];
- else if (!strcmp(argv[i], "-fn")) /* font or font set */
-- fonts[0] = argv[++i];
-+ tempfonts = argv[++i];
- else if (!strcmp(argv[i], "-nb")) /* normal background color */
-- colors[SchemeNorm][ColBg] = argv[++i];
-+ colortemp[0] = argv[++i];
- else if (!strcmp(argv[i], "-nf")) /* normal foreground color */
-- colors[SchemeNorm][ColFg] = argv[++i];
-+ colortemp[1] = argv[++i];
- else if (!strcmp(argv[i], "-sb")) /* selected background color */
-- colors[SchemeSel][ColBg] = argv[++i];
-+ colortemp[2] = argv[++i];
- else if (!strcmp(argv[i], "-sf")) /* selected foreground color */
-- colors[SchemeSel][ColFg] = argv[++i];
-+ colortemp[3] = argv[++i];
- else if (!strcmp(argv[i], "-w")) /* embedding window id */
- embed = argv[++i];
- else
-@@ -743,8 +788,23 @@ main(int argc, char *argv[])
- die("could not get embedding window attributes: 0x%lx",
- parentwin);
- drw = drw_create(dpy, screen, root, wa.width, wa.height);
-- if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
-+ readxresources();
-+ /* Now we check whether to override xresources with commandline parameters */
-+ if ( tempfonts )
-+ fonts[0] = strdup(tempfonts);
-+ if ( colortemp[0])
-+ colors[SchemeNorm][ColBg] = strdup(colortemp[0]);
-+ if ( colortemp[1])
-+ colors[SchemeNorm][ColFg] = strdup(colortemp[1]);
-+ if ( colortemp[2])
-+ colors[SchemeSel][ColBg] = strdup(colortemp[2]);
-+ if ( colortemp[3])
-+ colors[SchemeSel][ColFg] = strdup(colortemp[3]);
-+
-+ if (!drw_fontset_create(drw, (const char**)fonts, LENGTH(fonts)))
- die("no fonts could be loaded.");
-+
-+ free(fonts[0]);
- lrpad = drw->fonts->h;
-
- #ifdef __OpenBSD__