#define USAGE \
        "st-" VERSION ", (c) 2010-2011 st engineers\n" \
-       "usage: st [-t title] [-c class] [-v] [-e command...]\n"
+       "usage: st [-t title] [-c class] [-w windowid] [-v] [-e command...]\n"
 
 /* Arbitrary sizes */
 #define ESC_TITLE_SIZ 256
 static Selection sel;
 static char **opt_cmd  = NULL;
 static char *opt_title = NULL;
+static char *opt_embed = NULL;
 static char *opt_class = NULL;
 
 int
 xinit(void) {
        XSetWindowAttributes attrs;
        Cursor cursor;
+       Window parent;
 
        if(!(xw.dpy = XOpenDisplay(NULL)))
                die("Can't open display\n");
                | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
        attrs.colormap = xw.cmap;
 
-       xw.win = XCreateWindow(xw.dpy, XRootWindow(xw.dpy, xw.scr), 0, 0,
+       parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
+       xw.win = XCreateWindow(xw.dpy, parent, 0, 0,
                        xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
                        XDefaultVisual(xw.dpy, xw.scr),
                        CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
                case 'c':
                        if(++i < argc) opt_class = argv[i];
                        break;
+               case 'w':
+                       if(++i < argc) opt_embed = argv[i];
+                       break;
                case 'e': 
                        /* eat every remaining arguments */
                        if(++i < argc) opt_cmd = &argv[i];