diff options
author | Jackson Taylor <jackson@jacksontaylor.xyz> | 2022-06-18 21:47:42 -0400 |
---|---|---|
committer | Jackson Taylor <jackson@jacksontaylor.xyz> | 2022-06-18 21:47:42 -0400 |
commit | da869fadd0aa4ecd0be5ee0c4576d8160cb9f4b4 (patch) | |
tree | 0af2b311981ad70cb69f8d9d12e29b26450fb622 /dwm.c | |
parent | af5759a315d4c2f9fa217321f2dfabc97841bf1e (diff) |
Add cmd-customize patch
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 37 |
1 files changed, 33 insertions, 4 deletions
@@ -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))) |