summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2022-06-18 21:47:42 -0400
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-06-18 21:47:42 -0400
commitda869fadd0aa4ecd0be5ee0c4576d8160cb9f4b4 (patch)
tree0af2b311981ad70cb69f8d9d12e29b26450fb622 /dwm.c
parentaf5759a315d4c2f9fa217321f2dfabc97841bf1e (diff)
Add cmd-customize patch
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index 0f23ab16..ebbf7dd7 100644
--- a/dwm.c
+++ b/dwm.c
@@ -175,6 +175,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);
@@ -973,6 +974,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)
{
@@ -2147,10 +2154,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)))