aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper2007-05-10 17:23:49 +0000
committerjasper2007-05-10 17:23:49 +0000
commit819c368aa4ef1cf9aab7cb7416728c3cddcd5a43 (patch)
tree916edfa06fd117cba4a5a137d2fe1f285b5f3ca7
parentef7a73c51f1e8c490b81c82229f4d9430f1a010d (diff)
downloadcwm-819c368aa4ef1cf9aab7cb7416728c3cddcd5a43.tar.gz
- 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@
Diffstat (limited to '')
-rw-r--r--calmwm.c17
-rw-r--r--calmwm.h4
-rw-r--r--cwm.113
3 files changed, 26 insertions, 8 deletions
diff --git a/calmwm.c b/calmwm.c
index ff09bfc..3c2cc6f 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: calmwm.c,v 1.1.1.1 2007/04/27 17:58:48 bernd Exp $
+ * $Id: calmwm.c,v 1.2 2007/05/10 17:23:49 jasper Exp $
*/
#include "headers.h"
@@ -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);
diff --git a/calmwm.h b/calmwm.h
index 9aef4fe..213d88d 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: calmwm.h,v 1.2 2007/04/27 18:08:14 bernd Exp $
+ * $Id: calmwm.h,v 1.3 2007/05/10 17:23:49 jasper Exp $
*/
#ifndef _CALMWM_H_
@@ -285,7 +285,7 @@ struct mwm_hints {
int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int);
int x_errorhandler(Display *, XErrorEvent *);
-void x_setup(void);
+void x_setup(char *display_name);
char *x_screenname(int);
void x_loop(void);
int x_setupscreen(struct screen_ctx *, u_int);
diff --git a/cwm.1 b/cwm.1
index 8f4c70b..1f8158d 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.2 2007/04/27 18:08:14 bernd Exp $
+.\" $OpenBSD: cwm.1,v 1.3 2007/05/10 17:23:49 jasper Exp $
.\"
.\" The following requests are required for all man pages.
.Dd July 10, 2004
@@ -10,6 +10,7 @@
.Sh SYNOPSIS
.\" For a program: program [-abc] file ...
.Nm cwm
+.Op Fl d Ar display
.Op Fl s
.Op Fl f Ar fontname
.Sh DESCRIPTION
@@ -104,6 +105,8 @@ The options for
.Nm
are as follows:
.Bl -tag -width Ds
+.It Fl d Ar display
+Specify the display to use.
.It Fl s
Set sticky group mode on.
The default behavior for new windows is to not assign any group.
@@ -204,6 +207,14 @@ and
.Xr xlock 1 ,
respectively.
+.Sh ENVIRONMENT
+.TP
+DISPLAY
+.Nm
+starts on this display unless the
+.Fl d
+option is given.
+
.Sh ACKNOWLEDGEMENTS
.Nm
contains some code from 9wm.