[dev] [PATCH] Add dmenu "confirmed output" command line options

From: Mark Oteiza <mvoteiza_AT_udel.edu>
Date: Sat, 3 May 2014 15:54:50 -0400

As all the other colors are configurable by options, so should the
outbgcolor and outfgcolor. While these colors are not usually visible
with one-off dmenus, it is nice have access to them for dmenu scripts
(especially vertical lists) for doing things with multiple menu items.

---
 config.def.h |  4 ++--
 dmenu.1      | 10 ++++++++++
 dmenu.c      |  7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index c2a23fa..d0165b1 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -10,8 +10,8 @@ static const char *normbgcolor = "#222222"; /* -nb option; normal background
 static const char *normfgcolor = "#bbbbbb"; /* -nf option; normal foreground                 */
 static const char *selbgcolor  = "#005577"; /* -sb option; selected background               */
 static const char *selfgcolor  = "#eeeeee"; /* -sf option; selected foreground               */
-static const char *outbgcolor  = "#00ffff";
-static const char *outfgcolor  = "#000000";
+static const char *outbgcolor  = "#00ffff"; /* -ob option; confirmed output background       */
+static const char *outfgcolor  = "#000000"; /* -of option; confirmed output foreground       */
 /* -l option; if nonzero, dmenu uses vertical list with given number of lines */
 static unsigned int lines = 0;
 
diff --git a/dmenu.1 b/dmenu.1
index bbee17d..d61cf77 100644
--- a/dmenu.1
+++ b/dmenu.1
_AT_@ -22,6 +22,10 @@ dmenu \- dynamic menu
 .IR color ]
 .RB [ \-sf
 .IR color ]
+.RB [ \-ob
+.IR color ]
+.RB [ \-of
+.IR color ]
 .RB [ \-v ]
 .P
 .BR dmenu_run " ..."
_AT_@ -75,6 +79,12 @@ defines the selected background color.
 .BI \-sf " color"
 defines the selected foreground color.
 .TP
+.BI \-ob " color"
+defines the confirmed output background color.
+.TP
+.BI \-of " color"
+defines the confirmed output foreground color.
+.TP
 .B \-v
 prints version information to stdout, then exits.
 .SH USAGE
diff --git a/dmenu.c b/dmenu.c
index 8d9bbb6..2ff29c0 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -99,6 +99,10 @@ main(int argc, char *argv[]) {
 			selbgcolor = argv[++i];
 		else if(!strcmp(argv[i], "-sf"))  /* selected foreground color */
 			selfgcolor = argv[++i];
+		else if(!strcmp(argv[i], "-ob"))  /* confirmed output background color */
+			outbgcolor = argv[++i];
+		else if(!strcmp(argv[i], "-of"))  /* confirmed output foreground color */
+			outfgcolor = argv[++i];
 		else
 			usage();
 
_AT_@ -620,6 +624,7 @@ setup(void) {
 void
 usage(void) {
 	fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
-	      "             [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
+	      "             [-nb color] [-nf color] [-sb color] [-sf color]\n"
+	      "             [-ob color] [-of color] [-v]\n", stderr);
 	exit(EXIT_FAILURE);
 }
-- 
1.9.2
Received on Sat May 03 2014 - 21:54:50 CEST

This archive was generated by hypermail 2.3.0 : Sat May 03 2014 - 22:00:09 CEST