- add a "-d" option, to specify the display cwm should be started on

- adjust argc/argv by optind
- add an ENVIRONMENT section to the manpage

ok matthieu@ ray@
This commit is contained in:
jasper 2007-05-10 17:23:49 +00:00
parent 8d60503290
commit 9d51a8cf84
3 changed files with 23 additions and 5 deletions

View File

@ -55,10 +55,15 @@ main(int argc, char **argv)
int ch; int ch;
int conf_flags = 0; int conf_flags = 0;
char *display_name = NULL;
DefaultFontName = "sans-serif:pixelsize=14:bold"; DefaultFontName = "sans-serif:pixelsize=14:bold";
while ((ch = getopt(argc, argv, "sf:")) != -1) { while ((ch = getopt(argc, argv, "d:sf:")) != -1) {
switch (ch) { switch (ch) {
case 'd':
display_name = optarg;
break;
case 's': case 's':
conf_flags |= CONF_STICKY_GROUPS; conf_flags |= CONF_STICKY_GROUPS;
break; break;
@ -69,6 +74,8 @@ main(int argc, char **argv)
errx(1, "Unknown option '%c'", ch); errx(1, "Unknown option '%c'", ch);
} }
} }
argc -= optind;
argv +- optind;
/* Ignore a few signals. */ /* Ignore a few signals. */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
@ -83,7 +90,7 @@ main(int argc, char **argv)
conf_setup(&G_conf); conf_setup(&G_conf);
G_conf.flags |= conf_flags; G_conf.flags |= conf_flags;
client_setup(); client_setup();
x_setup(); x_setup(display_name);
G_starting = 0; G_starting = 0;
xev_init(); xev_init();
@ -108,7 +115,7 @@ main(int argc, char **argv)
} }
void void
x_setup(void) x_setup(char *display_name)
{ {
int i; int i;
struct screen_ctx *sc; struct screen_ctx *sc;
@ -116,7 +123,7 @@ x_setup(void)
TAILQ_INIT(&G_screenq); TAILQ_INIT(&G_screenq);
if ((G_dpy = XOpenDisplay("")) == NULL) if ((G_dpy = XOpenDisplay(display_name)) == NULL)
errx(1, "%s:%d XOpenDisplay()", __FILE__, __LINE__); errx(1, "%s:%d XOpenDisplay()", __FILE__, __LINE__);
XSetErrorHandler(x_errorhandler); XSetErrorHandler(x_errorhandler);

View File

@ -285,7 +285,7 @@ struct mwm_hints {
int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int); int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int);
int x_errorhandler(Display *, XErrorEvent *); int x_errorhandler(Display *, XErrorEvent *);
void x_setup(void); void x_setup(char *display_name);
char *x_screenname(int); char *x_screenname(int);
void x_loop(void); void x_loop(void);
int x_setupscreen(struct screen_ctx *, u_int); int x_setupscreen(struct screen_ctx *, u_int);

11
cwm.1
View File

@ -10,6 +10,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.\" For a program: program [-abc] file ... .\" For a program: program [-abc] file ...
.Nm cwm .Nm cwm
.Op Fl d Ar display
.Op Fl s .Op Fl s
.Op Fl f Ar fontname .Op Fl f Ar fontname
.Sh DESCRIPTION .Sh DESCRIPTION
@ -104,6 +105,8 @@ The options for
.Nm .Nm
are as follows: are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl d Ar display
Specify the display to use.
.It Fl s .It Fl s
Set sticky group mode on. Set sticky group mode on.
The default behavior for new windows is to not assign any group. The default behavior for new windows is to not assign any group.
@ -204,6 +207,14 @@ and
.Xr xlock 1 , .Xr xlock 1 ,
respectively. respectively.
.Sh ENVIRONMENT
.TP
DISPLAY
.Nm
starts on this display unless the
.Fl d
option is given.
.Sh ACKNOWLEDGEMENTS .Sh ACKNOWLEDGEMENTS
.Nm .Nm
contains some code from 9wm. contains some code from 9wm.