[Thread Prev][Thread Next]   >Date Index >Thread Index

[wmx] configuration of tab and frame colour from .wmx

Zvezdan Petkovic - Tue Oct 01 11:46:39 2002

For some reason I decided to replace my good old grey tabs with some
other colour.  Since that required some experimenting, I concluded after
several recompilations that it is not a very convenient approach.

So I added to Config.C and Config.h the support for the following
options:

	- tabfg:colour		# e.g. light blue
	- tabbg:colour		# e.g. royal blue
	- framebg:colour	# e.g. cornflower blue

Now I can just make a symbolic link to ~/.wmx/options from

	tabbg:#51596aaa52ff/tabfg:#aec0cd92b1dc/framebg:#aec0cd92b1dc

and get a nice shade of green tabs.  And then I can change them to
some other colour until I'm happy with it, or simply remove the link and
go back to grey tabs.

The patch is attached if you want to include it in the next release.

-- 
Zvezdan Petkovic <zvezdan@cs.wm.edu>
http://www.cs.wm.edu/~zvezdan/
diff -Naur wmx-6/Config.C wmx-6conf/Config.C
--- wmx-6/Config.C	Thu Mar  2 08:56:35 2000
+++ wmx-6conf/Config.C	Tue Oct  1 03:29:39 2002
@@ -7,6 +7,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+// 32 is enough to fit even "light goldenrod yellow" comfortably
+#define COLOR_LEN 32
+
 DynamicConfig DynamicConfig::dynamicConfig;
 
 struct DynamicConfigImpl
@@ -21,6 +24,9 @@
     int  feeddelay;
     char disable;	// 0 = New Window option, 1 = no New
     char rightBt;	// 0 = disable, 1 = circulate, 2 = lower, 4 = height
+    char tabfg[COLOR_LEN];     // black
+    char tabbg[COLOR_LEN];     // gray80
+    char framebg[COLOR_LEN];   // gray95
 };  
 
 DynamicConfig::DynamicConfig() : m_impl(new DynamicConfigImpl)
@@ -57,6 +63,9 @@
     m_impl->feeddelay = 300;
     m_impl->disable = 0;        // 0 = allow New window, 1 = don't
     m_impl->rightBt = 1;	// 0 = disable, 1 = circulate, 2 = lower
+    strcpy(m_impl->tabfg, "black");
+    strcpy(m_impl->tabbg, "gray80");
+    strcpy(m_impl->framebg, "gray95");
 
     scan(1);
 }
@@ -78,6 +87,9 @@
 char DynamicConfig::rightCirculate() { return m_impl->rightBt & 1; }
 char DynamicConfig::rightLower() { return m_impl->rightBt & 2; }
 char DynamicConfig::rightToggleHeight() { return m_impl->rightBt & 4; }
+char *DynamicConfig::tabForeground() { return m_impl->tabfg; }
+char *DynamicConfig::tabBackground() { return m_impl->tabbg; }
+char *DynamicConfig::frameBackground() { return m_impl->framebg; }
 
 void DynamicConfig::scan(char startup)
 {
@@ -138,7 +150,11 @@
 	    else if (OPTION("circulate")) m_impl->rightBt = 1;
 	    else if (OPTION("lower")) m_impl->rightBt = 2;
 	    else if (OPTION("toggleheight")) m_impl->rightBt = 4;
-	
+
+	if (OPTION("tabfg:")) strncpy(m_impl->tabfg, s, COLOR_LEN);
+	if (OPTION("tabbg:")) strncpy(m_impl->tabbg, s, COLOR_LEN);
+	if (OPTION("framebg:")) strncpy(m_impl->framebg, s, COLOR_LEN);
+
 	if (*s != '\0') {
 	    fprintf(stderr, "\nwmx: Dynamic configuration error: "
 		    "`%s' @ position %d", s, string - s);
diff -Naur wmx-6/Config.h wmx-6conf/Config.h
--- wmx-6/Config.h	Wed May 24 11:48:59 2000
+++ wmx-6conf/Config.h	Tue Oct  1 03:29:46 2002
@@ -51,6 +51,9 @@
     char rightCirculate();
     char rightLower();
     char rightToggleHeight();
+    char *tabForeground();
+    char *tabBackground();
+    char *frameBackground();
 
     static DynamicConfig dynamicConfig;
 
@@ -280,15 +283,15 @@
 // one-pixel border around the edge of each piece of decoration, not
 // for the whole decoration
 
-#define CONFIG_TAB_FOREGROUND	  "black"
-#define CONFIG_TAB_BACKGROUND     "gray80"
-#define CONFIG_FRAME_BACKGROUND   "gray95"
-#define CONFIG_BUTTON_BACKGROUND  "gray95"
+#define CONFIG_TAB_FOREGROUND     (dConfig.tabForeground())
+#define CONFIG_TAB_BACKGROUND     (dConfig.tabBackground())
+#define CONFIG_FRAME_BACKGROUND   (dConfig.frameBackground())
+#define CONFIG_BUTTON_BACKGROUND  (dConfig.frameBackground())
 #define CONFIG_BORDERS            "black"
 #define CONFIG_CHANNEL_NUMBER	  "green"
 
-#define CONFIG_MENU_FOREGROUND    "black"
-#define CONFIG_MENU_BACKGROUND    "gray80"
+#define CONFIG_MENU_FOREGROUND    (dConfig.tabForeground())
+#define CONFIG_MENU_BACKGROUND    (dConfig.tabBackground())
 #define CONFIG_MENU_BORDERS       "black"
 
 // Pixel width for the bit of frame to the left of the window and the

Next: