From 380c783155ea9c8af5c3c7e65bfb3b8c12c5e6ff Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 8 Nov 2012 21:48:51 +0100 Subject: Allowing a different position for the window id. Thanks David Galos! --- tabbed.1 | 23 +++++++++++++++++++++++ tabbed.c | 17 ++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/tabbed.1 b/tabbed.1 index 0950907..7f71386 100644 --- a/tabbed.1 +++ b/tabbed.1 @@ -9,6 +9,8 @@ tabbed \- generic tabbed interface .RB [ \-v ] .RB [ \-n .IR name ] +.RB [ \-r +.IR narg ] .IR [ command ... ] .SH DESCRIPTION .B tabbed @@ -29,6 +31,13 @@ will print the usage of tabbed. will set the WM_CLASS attribute to .I name. .TP +.BI \-r " narg" +will replace the +.I narg +th argument in +.I command +with the window id, rather than appending it to the end. +.TP .B \-s will disable automatic spawning of the command. .TP @@ -61,4 +70,18 @@ $ tabbed urxvt -embed $ tabbed xterm -into .TP $ $(tabbed -d >/tmp/tabbed.xid); urxvt -embed $( 0)? replace : argc] = winid; + cmd[argc + !(replace > 0)] = NULL; } void @@ -952,12 +952,12 @@ char *argv0; void usage(void) { - die("usage: %s [-dhsv] [-n name] command...\n", argv0); + die("usage: %s [-dhsv] [-n name] [-r narg] command...\n", argv0); } int main(int argc, char *argv[]) { - int detach = 0; + int detach = 0, replace = 0; ARGBEGIN { case 'd': @@ -966,6 +966,9 @@ main(int argc, char *argv[]) { case 'n': wmname = EARGF(usage()); break; + case 'r': + replace = atoi(EARGF(usage())); + break; case 's': doinitspawn = False; break; @@ -981,7 +984,7 @@ main(int argc, char *argv[]) { if(argc < 1) doinitspawn = False; - setcmd(argc, argv); + setcmd(argc, argv, replace); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "tabbed: no locale support\n"); -- cgit v1.2.3