1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
diff --git a/dwm.1 b/dwm.1
index e3b2c38..76011c7 100644
--- a/dwm.1
+++ b/dwm.1
@@ -3,7 +3,27 @@
dwm \- dynamic window manager
.SH SYNOPSIS
.B dwm
-.RB [ \-v ]
+.RB [ \-vh ]
+.RB [ \-fn
+.IR font ]
+.RB [ \-nb
+.IR color ]
+.RB [ \-nf
+.IR color ]
+.RB [ \-sb
+.IR color ]
+.RB [ \-sf
+.IR color ]
+.RB [ \-df
+.IR font ]
+.RB [ \-dnb
+.IR color ]
+.RB [ \-dnf
+.IR color ]
+.RB [ \-dsb
+.IR color ]
+.RB [ \-dsf
+.IR color ]
.SH DESCRIPTION
dwm is a dynamic window manager for X. It manages windows in tiled, monocle
and floating layouts. Either layout can be applied dynamically, optimising the
@@ -34,6 +54,43 @@ dwm draws a small border around windows to indicate the focus state.
.TP
.B \-v
prints version information to standard output, then exits.
+.TP
+.B \-h --help
+prints short help
+.TP
+.BI \-fn " font"
+defines the font or font set used.
+.TP
+.BI \-nb " color"
+defines the normal background color.
+.IR #RGB ,
+.IR #RRGGBB ,
+and X color names are supported.
+.TP
+.BI \-nf " color"
+defines the normal foreground color.
+.TP
+.BI \-sb " color"
+defines the selected background color.
+.TP
+.BI \-sf " color"
+defines the selected foreground color.
+.TP
+.BI \-df " font"
+defines the font used in dmenu_run.
+.TP
+.BI \-dnb " color"
+defines the normal background color in dmenu_run.
+.TP
+.BI \-dnf " color"
+defines the normal foreground color in dmenu_run.
+.TP
+.BI \-dsb " color"
+defines the selected background color in dmenu_run.
+.TP
+.BI \-dsf " color"
+defines the selected foreground color in dmenu_run.
+.TP
.SH USAGE
.SS Status bar
.TP
diff --git a/dwm.c b/dwm.c
index c98678d..dc1a679 100644
--- a/dwm.c
+++ b/dwm.c
@@ -174,6 +174,7 @@ static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
+static char* help();
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
@@ -963,6 +964,12 @@ grabkeys(void)
}
}
+char*
+help(void)
+{
+ return "usage: dwm [-hv] [-fn font] [-nb color] [-nf color] [-sb color] [-sf color]\n[-df font] [-dnf color] [-dnb color] [-dsf color] [-dsb color]\n";
+}
+
void
incnmaster(const Arg *arg)
{
@@ -2127,10 +2134,32 @@ zoom(const Arg *arg)
int
main(int argc, char *argv[])
{
- if (argc == 2 && !strcmp("-v", argv[1]))
- die("dwm-"VERSION);
- else if (argc != 1)
- die("usage: dwm [-v]");
+ for(int i=1;i<argc;i+=1)
+ if (!strcmp("-v", argv[i]))
+ die("dwm-"VERSION);
+ else if (!strcmp("-h", argv[i]) || !strcmp("--help", argv[i]))
+ die(help());
+ else if (!strcmp("-fn", argv[i])) /* font set */
+ fonts[0] = argv[++i];
+ else if (!strcmp("-nb",argv[i])) /* normal background color */
+ colors[SchemeNorm][1] = argv[++i];
+ else if (!strcmp("-nf",argv[i])) /* normal foreground color */
+ colors[SchemeNorm][0] = argv[++i];
+ else if (!strcmp("-sb",argv[i])) /* selected background color */
+ colors[SchemeSel][1] = argv[++i];
+ else if (!strcmp("-sf",argv[i])) /* selected foreground color */
+ colors[SchemeSel][0] = argv[++i];
+ else if (!strcmp("-df", argv[i])) /* dmenu font */
+ dmenucmd[4] = argv[++i];
+ else if (!strcmp("-dnb",argv[i])) /* dmenu normal background color */
+ dmenucmd[6] = argv[++i];
+ else if (!strcmp("-dnf",argv[i])) /* dmenu normal foreground color */
+ dmenucmd[8] = argv[++i];
+ else if (!strcmp("-dsb",argv[i])) /* dmenu selected background color */
+ dmenucmd[10] = argv[++i];
+ else if (!strcmp("-dsf",argv[i])) /* dmenu selected foreground color */
+ dmenucmd[12] = argv[++i];
+ else die(help());
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
|