Hi people, the attached patch lets tabbed expose its window ID to its children via the env var TABBED_WIN. This allows doing things like the following from inside tabbed:
st -t "Foo" -w $TABBED_WIN & st -t "Bar" -w $TABBED_WIN thus easing the use of different tab titles. -- $l="\n";$p=q-sub r{rand}sub c{((shift)**2+(shift)**2)<1}while( $i++<=$s){$t++if c r,r}die("Gregor Best, 0xDB9F9A7C, ".($t/$s* 4).$l)-;$s+=ord$$|$_ for split //,$p;srand($s|$$);eval$p;die$@
exporting patch: # HG changeset patch # User Gregor Best <g...@ring0.de> # Date 1307706900 -7200 # Node ID fdeaafa15c5bcc33b1676241df4083dc1005bf02 # Parent 1f090280fc824f4c5869f16db9e2d0d641d06d15 Set envvar TABBED_WIN to the window id This allows stuff like st -t "I'm a shell" -w $TABBED_WIN from inside tabbed. diff -r 1f090280fc82 -r fdeaafa15c5b config.mk --- a/config.mk Fri May 06 21:40:53 2011 +0100 +++ b/config.mk Fri Jun 10 13:55:00 2011 +0200 @@ -9,7 +9,7 @@ # includes and libs INCS = -I. -I/usr/include -LIBS = -L/usr/lib -lc -lX11 +LIBS = -L/usr/lib -lc -lm -lX11 # flags CPPFLAGS = -DVERSION=\"${VERSION}\" diff -r 1f090280fc82 -r fdeaafa15c5b tabbed.c --- a/tabbed.c Fri May 06 21:40:53 2011 +0100 +++ b/tabbed.c Fri Jun 10 13:55:00 2011 +0200 @@ -2,6 +2,7 @@ * * To understand tabbed, start reading main(). */ +#define _BSD_SOURCE // for the definition of setenv() #include <sys/wait.h> #include <locale.h> #include <stdarg.h> @@ -10,6 +11,8 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <math.h> +#include <stdlib.h> #include <X11/Xatom.h> #include <X11/Xlib.h> #include <X11/Xproto.h> @@ -858,7 +861,8 @@ int main(int argc, char *argv[]) { - int i, detach = 0; + int i, detach = 0, len; + char *tmp; for(i = 1; i < argc && !cmd; i++) { if(!strcmp("-v", argv[i])) @@ -875,6 +879,11 @@ if(!(dpy = XOpenDisplay(NULL))) die("tabbed: cannot open display\n"); setup(); + len = (int)(log10(win) + 2); + tmp = malloc(sizeof(char) * len); + snprintf(tmp, len, "%lu", win); + setenv("TABBED_WIN", tmp, 1); + free(tmp); printf("%lu\n", win); fflush(NULL); if(detach) {
pgpt5a2nFprNk.pgp
Description: PGP signature