On Tue, May 26, 2015 at 07:10:30PM +0200, Marc André Tanner wrote:
> On Mon, May 25, 2015 at 04:03:17PM -0400, Ross Mohn wrote:
> > On Mon, May 25, 2015 at 12:45:07PM -0700, Eric Pruitt wrote:
> > > On Mon, May 25, 2015 at 03:24:14PM -0400, Ross Mohn wrote:
> > > > The TAGKEYS macro from dwm's config.def.h is approriate for dvtm as
> > > > well. Patch is attached.
> > > 
> > > The parentheses in the patch seem to be unbalanced.
> > 
> > They may seem that way, but if you count them out they're balanced.
> 
> My compiler also thinks that they are unbalanced ...

OK, I see my mistake. Attached is working patch. Sorry!
-Ross

diff --git a/config.def.h b/config.def.h
index b0a68d4..b7d4769 100644
--- a/config.def.h
+++ b/config.def.h
@@ -51,7 +51,7 @@ static Color colors[] = {
 /* curses attributes for not selected tags which with urgent windows */
 #define TAG_URGENT (COLOR(BLUE) | A_NORMAL | A_BLINK)
 
-const char tags[][8] = { "1", "2", "3", "4", "5" };
+const char tags[][8] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 
 #include "tile.c"
 #include "grid.c"
@@ -67,6 +67,11 @@ static Layout layouts[] = {
 };
 
 #define MOD  CTRL('g')
+#define TAGKEYS(KEY,TAG) \
+	{ { MOD, 'v', KEY,     }, { view,           { tags[TAG] }               } }, \
+	{ { MOD, 't', KEY,     }, { tag,            { tags[TAG] }               } }, \
+	{ { MOD, 'V', KEY,     }, { toggleview,     { tags[TAG] }               } }, \
+	{ { MOD, 'T', KEY,     }, { toggletag,      { tags[TAG] }               } },
 
 /* you can at most specifiy MAX_ARGS (3) number of arguments */
 static KeyBinding bindings[] = {
@@ -122,28 +127,17 @@ static KeyBinding bindings[] = {
 	{ { MOD, KEY_F(4),     }, { view,           { tags[3] }                 } },
 	{ { MOD, KEY_F(5),     }, { view,           { tags[4] }                 } },
 	{ { MOD, 'v', '0'      }, { view,           { NULL }                    } },
-	{ { MOD, 'v', '1'      }, { view,           { tags[0] }                 } },
-	{ { MOD, 'v', '2'      }, { view,           { tags[1] }                 } },
-	{ { MOD, 'v', '3'      }, { view,           { tags[2] }                 } },
-	{ { MOD, 'v', '4'      }, { view,           { tags[3] }                 } },
-	{ { MOD, 'v', '5'      }, { view,           { tags[4] }                 } },
 	{ { MOD, 'v', '\t',    }, { viewprevtag,    { NULL }                    } },
 	{ { MOD, 't', '0'      }, { tag,            { NULL }                    } },
-	{ { MOD, 't', '1'      }, { tag,            { tags[0] }                 } },
-	{ { MOD, 't', '2'      }, { tag,            { tags[1] }                 } },
-	{ { MOD, 't', '3'      }, { tag,            { tags[2] }                 } },
-	{ { MOD, 't', '4'      }, { tag,            { tags[3] }                 } },
-	{ { MOD, 't', '5'      }, { tag,            { tags[4] }                 } },
-	{ { MOD, 'V', '1'      }, { toggleview,     { tags[0] }                 } },
-	{ { MOD, 'V', '2'      }, { toggleview,     { tags[1] }                 } },
-	{ { MOD, 'V', '3'      }, { toggleview,     { tags[2] }                 } },
-	{ { MOD, 'V', '4'      }, { toggleview,     { tags[3] }                 } },
-	{ { MOD, 'V', '5'      }, { toggleview,     { tags[4] }                 } },
-	{ { MOD, 'T', '1'      }, { toggletag,      { tags[0] }                 } },
-	{ { MOD, 'T', '2'      }, { toggletag,      { tags[1] }                 } },
-	{ { MOD, 'T', '3'      }, { toggletag,      { tags[2] }                 } },
-	{ { MOD, 'T', '4'      }, { toggletag,      { tags[3] }                 } },
-	{ { MOD, 'T', '5'      }, { toggletag,      { tags[4] }                 } },
+	TAGKEYS( '1',                              0)
+	TAGKEYS( '2',                              1)
+	TAGKEYS( '3',                              2)
+	TAGKEYS( '4',                              3)
+	TAGKEYS( '5',                              4)
+	TAGKEYS( '6',                              5)
+	TAGKEYS( '7',                              6)
+	TAGKEYS( '8',                              7)
+	TAGKEYS( '9',                              8)
 };
 
 static const ColorRule colorrules[] = {

Reply via email to