summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h1
-rw-r--r--config.def.h.orig28
-rw-r--r--diffs/dmenu-morecolor-20190922-4bf895b.diff47
-rwxr-xr-xdmenubin43496 -> 43512 bytes
-rw-r--r--dmenu.c8
-rw-r--r--dmenu.c.orig59
-rw-r--r--dmenu.obin34360 -> 34400 bytes
7 files changed, 139 insertions, 4 deletions
diff --git a/config.def.h b/config.def.h
index c979baf..8c95753 100644
--- a/config.def.h
+++ b/config.def.h
@@ -14,6 +14,7 @@ static const char *colors[SchemeLast][2] = {
[SchemeSelHighlight] = { "#ffc978", "#005577" },
[SchemeNormHighlight] = { "#ffc978", "#222222" },
[SchemeOut] = { "#000000", "#00ffff" },
+ [SchemeMid] = { "#eeeeee", "#770000" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
diff --git a/config.def.h.orig b/config.def.h.orig
new file mode 100644
index 0000000..c979baf
--- /dev/null
+++ b/config.def.h.orig
@@ -0,0 +1,28 @@
+/* See LICENSE file for copyright and license details. */
+/* Default settings; can be overriden by command line. */
+
+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"
+};
+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" },
+ [SchemeSelHighlight] = { "#ffc978", "#005577" },
+ [SchemeNormHighlight] = { "#ffc978", "#222222" },
+ [SchemeOut] = { "#000000", "#00ffff" },
+};
+/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
+static unsigned int lines = 0;
+
+/*
+ * Characters not considered part of a word while deleting words
+ * for example: " /?\"&[]"
+ */
+static const char worddelimiters[] = " ";
+
+/* Size of the window border */
+static unsigned int border_width = 0;
diff --git a/diffs/dmenu-morecolor-20190922-4bf895b.diff b/diffs/dmenu-morecolor-20190922-4bf895b.diff
new file mode 100644
index 0000000..539e9c1
--- /dev/null
+++ b/diffs/dmenu-morecolor-20190922-4bf895b.diff
@@ -0,0 +1,47 @@
+From 4bf895be219ae00394a5cde901dc43ec6dcb3759 Mon Sep 17 00:00:00 2001
+From: Tanner Babcock <babkock@gmail.com>
+Date: Sun, 22 Sep 2019 03:07:26 -0500
+Subject: [PATCH] Additional color scheme, for adjacent entries
+
+---
+ config.def.h | 1 +
+ dmenu.c | 4 +++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1edb647..767c88f 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -12,6 +12,7 @@ static const char *colors[SchemeLast][2] = {
+ [SchemeNorm] = { "#bbbbbb", "#222222" },
+ [SchemeSel] = { "#eeeeee", "#005577" },
+ [SchemeOut] = { "#000000", "#00ffff" },
++ [SchemeMid] = { "#eeeeee", "#770000" },
+ };
+ /* -l option; if nonzero, dmenu uses vertical list with given number of lines */
+ static unsigned int lines = 0;
+diff --git a/dmenu.c b/dmenu.c
+index 65f25ce..0a5c08d 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -26,7 +26,7 @@
+ #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+
+ /* enums */
+-enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
++enum { SchemeNorm, SchemeSel, SchemeOut, SchemeMid, SchemeLast }; /* color schemes */
+
+ struct item {
+ char *text;
+@@ -118,6 +118,8 @@ drawitem(struct item *item, int x, int y, int w)
+ {
+ if (item == sel)
+ drw_setscheme(drw, scheme[SchemeSel]);
++ else if (item->left == sel || item->right == sel)
++ drw_setscheme(drw, scheme[SchemeMid]);
+ else if (item->out)
+ drw_setscheme(drw, scheme[SchemeOut]);
+ else
+--
+2.23.0
+
diff --git a/dmenu b/dmenu
index b2dc0a9..147e234 100755
--- a/dmenu
+++ b/dmenu
Binary files differ
diff --git a/dmenu.c b/dmenu.c
index 9497736..1bd6b76 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -26,9 +26,13 @@
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
+// <<<<<<<
enum { SchemeNorm, SchemeSel, SchemeNormHighlight, SchemeSelHighlight,
- SchemeOut, SchemeLast }; /* color schemes */
+ SchemeOut, SchemeMid, SchemeLast }; /* color schemes */
+// =======
+// enum { SchemeNorm, SchemeSel, SchemeOut, SchemeMid, SchemeLast }; /* color schemes */
+// >>>>>>>
struct item {
char *text;
@@ -161,6 +165,8 @@ drawitem(struct item *item, int x, int y, int w)
int r;
if (item == sel)
drw_setscheme(drw, scheme[SchemeSel]);
+ else if (item->left == sel || item->right == sel)
+ drw_setscheme(drw, scheme[SchemeMid]);
else if (item->out)
drw_setscheme(drw, scheme[SchemeOut]);
else
diff --git a/dmenu.c.orig b/dmenu.c.orig
index 8b0930c..9497736 100644
--- a/dmenu.c.orig
+++ b/dmenu.c.orig
@@ -26,7 +26,9 @@
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
-enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
+enum { SchemeNorm, SchemeSel, SchemeNormHighlight, SchemeSelHighlight,
+ SchemeOut, SchemeLast }; /* color schemes */
+
struct item {
char *text;
@@ -114,9 +116,49 @@ cistrstr(const char *s, const char *sub)
return NULL;
}
+static void
+drawhighlights(struct item *item, int x, int y, int maxw)
+{
+ int i, indent;
+ char *highlight;
+ char c;
+
+ if (!(strlen(item->text) && strlen(text)))
+ return;
+
+ drw_setscheme(drw, scheme[item == sel
+ ? SchemeSelHighlight
+ : SchemeNormHighlight]);
+ for (i = 0, highlight = item->text; *highlight && text[i];) {
+ if (*highlight == text[i]) {
+ /* get indentation */
+ c = *highlight;
+ *highlight = '\0';
+ indent = TEXTW(item->text);
+ *highlight = c;
+
+ /* highlight character */
+ c = highlight[1];
+ highlight[1] = '\0';
+ drw_text(
+ drw,
+ x + indent - (lrpad / 2),
+ y,
+ MIN(maxw - indent, TEXTW(highlight) - lrpad),
+ bh, 0, highlight, 0
+ );
+ highlight[1] = c;
+ i++;
+ }
+ highlight++;
+ }
+}
+
+
static int
drawitem(struct item *item, int x, int y, int w)
{
+ int r;
if (item == sel)
drw_setscheme(drw, scheme[SchemeSel]);
else if (item->out)
@@ -124,7 +166,9 @@ drawitem(struct item *item, int x, int y, int w)
else
drw_setscheme(drw, scheme[SchemeNorm]);
- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
+ r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
+ drawhighlights(item, x, y, w);
+ return r;
}
static void
@@ -693,7 +737,8 @@ static void
usage(void)
{
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);
+ " [-nb color] [-nf color] [-sb color] [-sf color]\n"
+ " [-nhb color] [-nhf color] [-shb color] [-shf color] [-w windowid]\n", stderr);
exit(1);
}
@@ -734,6 +779,14 @@ main(int argc, char *argv[])
colors[SchemeSel][ColBg] = argv[++i];
else if (!strcmp(argv[i], "-sf")) /* selected foreground color */
colors[SchemeSel][ColFg] = argv[++i];
+ else if (!strcmp(argv[i], "-nhb")) /* normal hi background color */
+ colors[SchemeNormHighlight][ColBg] = argv[++i];
+ else if (!strcmp(argv[i], "-nhf")) /* normal hi foreground color */
+ colors[SchemeNormHighlight][ColFg] = argv[++i];
+ else if (!strcmp(argv[i], "-shb")) /* selected hi background color */
+ colors[SchemeSelHighlight][ColBg] = argv[++i];
+ else if (!strcmp(argv[i], "-shf")) /* selected hi foreground color */
+ colors[SchemeSelHighlight][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
else if (!strcmp(argv[i], "-bw"))
diff --git a/dmenu.o b/dmenu.o
index aeec45a..4717bf7 100644
--- a/dmenu.o
+++ b/dmenu.o
Binary files differ