[dev] [tabbed] [PATCH] Allow selecting the colors on command line.

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Thu, 12 Dec 2013 18:06:51 +0100

---
Heyho,
When using tabbed for surf the content mostly has a bright background.
When using tabbed for st the terminal at least for me has a dark background.
Since I did not find a color configuration for tabbed which works for both use
cases, I wrote this patch. Since I don't think arg.h allows parameters
consisting of more than one char, I did not use the same parameters as in dmenu.
Instead I used a upper- / lower-case combination.
There were also two missing „break;“ lines in the arg parser, which I fixed.
Regards,
Markus
 config.def.h |  8 ++++----
 tabbed.1     | 15 +++++++++++++++
 tabbed.c     | 18 ++++++++++++++++--
 3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index 3a92bd9..ceda9f7 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -2,10 +2,10 @@
 
 /* appearance */
 static const char font[]        = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*";
-static const char normbgcolor[] = "#222222";
-static const char normfgcolor[] = "#cccccc";
-static const char selbgcolor[]  = "#555555";
-static const char selfgcolor[]  = "#ffffff";
+static const char* normbgcolor  = "#222222";
+static const char* normfgcolor  = "#cccccc";
+static const char* selbgcolor   = "#555555";
+static const char* selfgcolor   = "#ffffff";
 static const char before[]      = "<";
 static const char after[]       = ">";
 static const int  tabwidth      = 200;
diff --git a/tabbed.1 b/tabbed.1
index 0ec623e..0ae29ce 100644
--- a/tabbed.1
+++ b/tabbed.1
_AT_@ -70,6 +70,21 @@ with the window id, rather than appending it to the end.
 .B \-s
 will disable automatic spawning of the command.
 .TP
+.BI \-t " color"
+defines the selected background color.
+.IR #RGB ,
+.IR #RRGGBB ,
+and X color names are supported.
+.TP
+.BI \-T " color"
+defines the selected foreground color.
+.TP
+.BI \-u " color"
+defines the normal background color.
+.TP
+.BI \-U " color"
+defines the normal foreground color.
+.TP
 .B \-v
 prints version information to stderr, then exits.
 .SH USAGE
diff --git a/tabbed.c b/tabbed.c
index e870db4..9405644 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -1197,8 +1197,8 @@ char *argv0;
 
 void
 usage(void) {
-	die("usage: %s [-dfhsv] [-g geometry] [-n name] [-p [s+/-]pos] "
-		"[-r narg] command...\n", argv0);
+	die("usage: %s [-dfhsv] [-g geometry] [-n name] [-p [s+/-]pos] [-r narg] "
+		"[-u color] [-U color] [-t color] [-T color] command...\n", argv0);
 }
 
 int
_AT_@ -1211,6 +1211,7 @@ main(int argc, char *argv[]) {
 	case 'c':
 		closelastclient = True;
 		fillagain = False;
+		break;
 	case 'd':
 		detach = True;
 		break;
_AT_@ -1242,6 +1243,19 @@ main(int argc, char *argv[]) {
 		die("tabbed-"VERSION", © 2009-2012"
 			" tabbed engineers, see LICENSE"
 			" for details.\n");
+		break;
+	case 't':
+		selbgcolor = EARGF(usage());
+		break;
+	case 'T':
+		selfgcolor = EARGF(usage());
+		break;
+	case 'u':
+		normbgcolor = EARGF(usage());
+		break;
+	case 'U':
+		normfgcolor = EARGF(usage());
+		break;
 	default:
 	case 'h':
 		usage();
-- 
1.8.2
Received on Thu Dec 12 2013 - 18:06:51 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 12 2013 - 18:12:13 CET