commit 0139c17d446fde442f7e1b2a67097806ea66a3ea
parent 552655a296b62089dd99d065d8da448d499994b7
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 23 Dec 2017 18:45:41 +0100
Allow toggling foreground dynamically.
Diffstat:
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/config.mk b/config.mk
@@ -14,7 +14,7 @@ LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
 # flags
 CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
 CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
-LDFLAGS = -s ${LIBS}
+LDFLAGS = -g ${LIBS}
 
 # Solaris
 #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
diff --git a/tabbed.1 b/tabbed.1
@@ -7,6 +7,8 @@ tabbed \- generic tabbed interface
 .RB [ \-b ]
 .RB [ \-c ]
 .RB [ \-d ]
+.RB [ \-e ]
+.RB [ \-E ]
 .RB [ \-k ]
 .RB [ \-M ]
 .RB [ \-m ]
@@ -54,6 +56,12 @@ close tabbed when the last tab is closed. Mutually exclusive with -f.
 .B \-d
 detaches tabbed from the terminal and prints its XID to stdout.
 .TP
+.B \-e
+open new tabs by default in foreground.
+.TP
+.B \-E
+open new tabs by default in background.
+.TP
 .B \-f
 fill up tabbed again by spawning the provided command, when the last tab is
 closed. Mutually exclusive with -c.
@@ -141,6 +149,9 @@ move selected tab one to the left
 .B Ctrl\-Shift\-k
 move selected tab one to the right
 .TP
+.B Ctrl\-Shift\-e
+toggle behaviour of opening tabs in forground or background.
+.TP
 .B Ctrl\-Shift\-u
 toggle autofocus of urgent tabs
 .TP
diff --git a/tabbed.c b/tabbed.c
@@ -778,9 +778,11 @@ manage(Window w)
 	/* Adjust sel before focus does set it to lastsel. */
 	if (sel >= nextpos)
 		sel++;
+	printf("nextfocus = %d\n", nextfocus);
 	focus(nextfocus ? nextpos :
 	      sel < 0 ? 0 :
 	      sel);
+	printf("foreground = %d\n", foreground);
 	nextfocus = foreground;
 }
 
@@ -1332,6 +1334,12 @@ main(int argc, char *argv[])
 	case 'd':
 		detach = True;
 		break;
+	case 'e':
+		foreground = True;
+		break;
+	case 'E':
+		foreground = False;
+		break;
 	case 'f':
 		fillagain = True;
 		break;