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