add -w option to embed st. (thx nodus cursorius)
parent
4736edd469
commit
3959a99293
6
st.1
6
st.1
|
@ -7,6 +7,8 @@ st \- simple terminal
|
||||||
.IR class ]
|
.IR class ]
|
||||||
.RB [ \-t
|
.RB [ \-t
|
||||||
.IR title ]
|
.IR title ]
|
||||||
|
.RB [ \-w
|
||||||
|
.IR windowid ]
|
||||||
.RB [ \-v ]
|
.RB [ \-v ]
|
||||||
.RB [ \-e
|
.RB [ \-e
|
||||||
.IR command ...]
|
.IR command ...]
|
||||||
|
@ -21,6 +23,10 @@ defines the window title (default 'st').
|
||||||
.BI \-c " class"
|
.BI \-c " class"
|
||||||
defines the window class (default $TERM).
|
defines the window class (default $TERM).
|
||||||
.TP
|
.TP
|
||||||
|
.BI \-w " windowid"
|
||||||
|
embeds st within the window identified by
|
||||||
|
.I windowid
|
||||||
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
prints version information to stderr, then exits.
|
prints version information to stderr, then exits.
|
||||||
.TP
|
.TP
|
||||||
|
|
10
st.c
10
st.c
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
#define USAGE \
|
#define USAGE \
|
||||||
"st-" VERSION ", (c) 2010-2011 st engineers\n" \
|
"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 */
|
/* Arbitrary sizes */
|
||||||
#define ESC_TITLE_SIZ 256
|
#define ESC_TITLE_SIZ 256
|
||||||
|
@ -260,6 +260,7 @@ static pid_t pid;
|
||||||
static Selection sel;
|
static Selection sel;
|
||||||
static char **opt_cmd = NULL;
|
static char **opt_cmd = NULL;
|
||||||
static char *opt_title = NULL;
|
static char *opt_title = NULL;
|
||||||
|
static char *opt_embed = NULL;
|
||||||
static char *opt_class = NULL;
|
static char *opt_class = NULL;
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1606,6 +1607,7 @@ void
|
||||||
xinit(void) {
|
xinit(void) {
|
||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
Window parent;
|
||||||
|
|
||||||
if(!(xw.dpy = XOpenDisplay(NULL)))
|
if(!(xw.dpy = XOpenDisplay(NULL)))
|
||||||
die("Can't open display\n");
|
die("Can't open display\n");
|
||||||
|
@ -1636,7 +1638,8 @@ xinit(void) {
|
||||||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||||
attrs.colormap = xw.cmap;
|
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,
|
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
||||||
XDefaultVisual(xw.dpy, xw.scr),
|
XDefaultVisual(xw.dpy, xw.scr),
|
||||||
CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
|
CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
|
||||||
|
@ -1943,6 +1946,9 @@ main(int argc, char *argv[]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
if(++i < argc) opt_class = argv[i];
|
if(++i < argc) opt_class = argv[i];
|
||||||
break;
|
break;
|
||||||
|
case 'w':
|
||||||
|
if(++i < argc) opt_embed = argv[i];
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
/* eat every remaining arguments */
|
/* eat every remaining arguments */
|
||||||
if(++i < argc) opt_cmd = &argv[i];
|
if(++i < argc) opt_cmd = &argv[i];
|
||||||
|
|
Reference in New Issue