commit 0dc407c488760cdf3e37b47c19d6677e3ba8cbd2
parent da8eac4c1b2c56ae246c4dd58b0de144cc7e62b5
Author: hhvn <dev@hhvn.uk>
Date: Fri, 22 Oct 2021 23:58:41 +0100
self-embed.patch: -e option for self embedding
I did this because I thought it might be cool, but unfortunately it only
works with the mouse. Also, I'm likely never gonna use it, so I made a
patch.
Diffstat:
1 file changed, 48 insertions(+), 0 deletions(-)
diff --git a/self-embed.patch b/self-embed.patch
@@ -0,0 +1,48 @@
+diff --git a/tabbed.c b/tabbed.c
+index 8066028..dae4ddc 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -168,6 +168,7 @@ static int cmd_append_pos;
+ static char winid[64];
+ static char **cmd;
+ static char *wmname = "tabbed";
++static char *selfembed = NULL;
+ static const char *geometry;
+
+ char *argv0;
+@@ -977,6 +978,7 @@ setup(void)
+ {
+ int bitm, tx, ty, tw, th, dh, dw, isfixed;
+ XWMHints *wmh;
++ Window parent;
+ XClassHint class_hint;
+ XSizeHints *size_hint;
+
+@@ -986,6 +988,8 @@ setup(void)
+ /* init screen */
+ screen = DefaultScreen(dpy);
+ root = RootWindow(dpy, screen);
++ if (!(selfembed && (parent = strtol(selfembed, NULL, 0))))
++ parent = root;
+ initfont(font);
+ bh = dc.h = dc.font.height + 2;
+
+@@ -1043,7 +1047,7 @@ setup(void)
+ DefaultDepth(dpy, screen));
+ dc.gc = XCreateGC(dpy, root, 0, 0);
+
+- win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
++ win = XCreateSimpleWindow(dpy, parent, wx, wy, ww, wh, 0,
+ dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
+ XMapRaised(dpy, win);
+ XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
+@@ -1340,6 +1344,9 @@ main(int argc, char *argv[])
+ die("tabbed-"VERSION", © 2009-2016 tabbed engineers, "
+ "see LICENSE for details.\n");
+ break;
++ case 'e':
++ selfembed = EARGF(usage());
++ break;
+ default:
+ usage();
+ break;