summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-05 23:56:43 +0200
committerbakkeby <[email protected]>2019-10-05 23:56:43 +0200
commitac4269a4f28f29bad9a319993ad814830248f89a (patch)
treeeabfabfca7ce1b90129364b9e21f53a2418f5b06
parentf096d003d9c33ec08f1d563e8f52c44f32ed80c8 (diff)
downloaddwm-flexipatch-ac4269a4f28f29bad9a319993ad814830248f89a.tar.gz
dwm-flexipatch-ac4269a4f28f29bad9a319993ad814830248f89a.zip
Adding cmdcustomize patch
-rw-r--r--README.md5
-rw-r--r--dwm.c29
-rw-r--r--patch/cmdcustomize.c5
-rw-r--r--patch/cmdcustomize.h1
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patches.h5
7 files changed, 52 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9a81c4d..df82b38 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
-2019-10-05 - Added killunsel, taggrid and hidevacanttags patches
+2019-10-05 - Added killunsel, taggrid, hidevacanttags and cmdcustomize patches
2019-10-04 - Added maximize, movestack, monoclesymbol, noborder, tagall and tagintostack patches
@@ -88,6 +88,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [cfacts](https://dwm.suckless.org/patches/cfacts/)
- the cfacts patch provides the ability to assign different weights to clients in their respective stack in tiled layout
+ - [cmdcustomize](https://dwm.suckless.org/patches/cmdcustomize/)
+ - allows color attributes to be set through the command line
+
- [combo](https://dwm.suckless.org/patches/combo/)
- allows you to select multiple tags by pressing all the right keys as a combo, e.g. hold MOD and press and hold 1 and 3 together to view those two tags
diff --git a/dwm.c b/dwm.c
index d1fd225..4834c97 100644
--- a/dwm.c
+++ b/dwm.c
@@ -3380,10 +3380,39 @@ zoom(const Arg *arg)
int
main(int argc, char *argv[])
{
+ #if CMDCUSTOMIZE
+ 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());
+ #else
if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION);
else if (argc != 1)
die("usage: dwm [-v]");
+ #endif // CMDCUSTOMIZE
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
diff --git a/patch/cmdcustomize.c b/patch/cmdcustomize.c
new file mode 100644
index 0000000..1e62d20
--- /dev/null
+++ b/patch/cmdcustomize.c
@@ -0,0 +1,5 @@
+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";
+} \ No newline at end of file
diff --git a/patch/cmdcustomize.h b/patch/cmdcustomize.h
new file mode 100644
index 0000000..280f5b8
--- /dev/null
+++ b/patch/cmdcustomize.h
@@ -0,0 +1 @@
+static char* help(); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 084f64e..8f4a0d0 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -24,6 +24,10 @@
#include "cfacts.c"
#endif
+#if CMDCUSTOMIZE
+#include "cmdcustomize.c"
+#endif
+
#if COMBO_PATCH
#include "combo.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 426853d..237b725 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -24,6 +24,10 @@
#include "cfacts.h"
#endif
+#if CMDCUSTOMIZE
+#include "cmdcustomize.h"
+#endif
+
#if COMBO_PATCH
#include "combo.h"
#endif
diff --git a/patches.h b/patches.h
index 1cb2863..7ddce63 100644
--- a/patches.h
+++ b/patches.h
@@ -98,6 +98,11 @@
*/
#define CFACTS_PATCH 0
+/* This patch allows color attributes to be set through the command line.
+ * https://dwm.suckless.org/patches/cmdcustomize/
+ */
+#define CMDCUSTOMIZE 0
+
/* This patch tweaks the tagging interface so that you can select multiple tags for tag
* or view by pressing all the right keys as a combo. For example to view tags 1 and 3,
* hold MOD and then press and hold 1 and 3 together.