diff options
-rw-r--r-- | dwm.1 | 65 | ||||
-rw-r--r-- | dwm.c | 37 | ||||
-rw-r--r-- | patches/dwm-cmdcustomize-20180504-3bd8466.diff | 139 |
3 files changed, 236 insertions, 5 deletions
@@ -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,49 @@ dwm draws a small border around windows to indicate the focus state. .TP .B \-v prints version information to stderr, then exits. +.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 .SH USAGE .SS Status bar .TP @@ -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))) diff --git a/patches/dwm-cmdcustomize-20180504-3bd8466.diff b/patches/dwm-cmdcustomize-20180504-3bd8466.diff new file mode 100644 index 00000000..1a451518 --- /dev/null +++ b/patches/dwm-cmdcustomize-20180504-3bd8466.diff @@ -0,0 +1,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))) |