commit a932365cb991abdfcfa6e921a0e23859cb73fc27
Author: user <user_AT_a>
Date: Fri Aug 4 21:30:56 2017 +0200
schemeSwitch
Added a patch for switching between light and dark color-schemes, with description
Changed the enum{SchemeSel, SchemeNorm} to global variables, wich are then changed
by two functions (schemeCycle() and schemeToggle()) to change the scheme.
diff --git a/dwm.suckless.org/patches/dwm-schemeSwitch-20170804-ceac8c9.diff b/dwm.suckless.org/patches/dwm-schemeSwitch-20170804-ceac8c9.diff
new file mode 100644
index 00000000..504fa55b
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-schemeSwitch-20170804-ceac8c9.diff
_AT_@ -0,0 +1,115 @@
+diff --git a/config.def.h b/config.def.h
+index a9ac303..b047735 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -12,10 +12,26 @@ static const char col_gray2[] = "#444444";
+ static const char col_gray3[] = "#bbbbbb";
+ static const char col_gray4[] = "#eeeeee";
+ static const char col_cyan[] = "#005577";
++
++/* solarized colors
http://ethanschoonover.com/solarized */
++static const char s_base03[] = "#002b36";
++static const char s_base02[] = "#073642";
++static const char s_base01[] = "#586e75";
++static const char s_base00[] = "#657b83";
++static const char s_base0[] = "#839496";
++static const char s_base1[] = "#93a1a1";
++static const char s_base2[] = "#eee8d5";
++static const char s_base3[] = "#fdf6e3";
++
++
+ static const char *colors[][3] = {
+ /* fg bg border */
+- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
++ { s_base0, s_base03, s_base2 }, /* SchemeNorm dark */
++ { s_base0, s_base02, s_base2 }, /* SchemeSel dark */
++ { s_base00, s_base3, s_base02 }, /* SchemeNorm light */
++ { s_base00, s_base2, s_base02}, /* SchemeSel light */
++ { col_gray3, col_gray1, col_gray2 }, /* SchemeNorm orig */
++ { col_gray4, col_cyan, col_cyan }, /* SchemeSel orig */
+ };
+
+ /* tagging */
+_AT_@ -84,6 +100,8 @@ static Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_t, schemeToggle, {0} },
++ { MODKEY|ShiftMask, XK_z, schemeCycle, {0} },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index a5ce993..511f2d6 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -60,7 +60,6 @@
+
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+-enum { SchemeNorm, SchemeSel }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+_AT_@ -195,6 +194,8 @@ static void resizemouse(const Arg *arg);
+ static void restack(Monitor *m);
+ static void run(void);
+ static void scan(void);
++static void schemeCycle(const Arg*);
++static void schemeToggle(const Arg*);
+ static int sendevent(Client *c, Atom proto);
+ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+_AT_@ -264,6 +265,7 @@ static Atom wmatom[WMLast], netatom[NetLast];
+ static int running = 1;
+ static Cur *cursor[CurLast];
+ static Scm *scheme;
++static int SchemeNorm = 0, SchemeSel = 1;
+ static Display *dpy;
+ static Drw *drw;
+ static Monitor *mons, *selmon;
+_AT_@ -1410,6 +1412,43 @@ scan(void)
+ }
+
+ void
++schemeCycle(const Arg *arg) {
++
++ if ((SchemeSel < LENGTH(colors) -1) &&
++ ((SchemeSel + 2) < LENGTH(colors)))
++ {
++ SchemeNorm += 2;
++ SchemeSel += 2;
++ } else {
++ SchemeNorm = 0;
++ SchemeSel = 1;
++ }
++
++ drawbars();
++}
++
++void
++schemeToggle(const Arg *arg) {
++
++ int numThemePairs = LENGTH(colors) / 4;
++ int sheme = SchemeNorm / 2;
++
++ if (sheme / 2 > numThemePairs-1) {
++ return;
++ }
++
++ if (sheme % 2 == 0) {
++ SchemeNorm += 2;
++ SchemeSel += 2;
++ } else {
++ SchemeNorm -= 2;
++ SchemeSel -= 2;
++ }
++
++ drawbars();
++}
++
++void
+ sendmon(Client *c, Monitor *m)
+ {
+ if (c->mon == m)
diff --git a/dwm.suckless.org/patches/schemeSwitch.md b/dwm.suckless.org/patches/schemeSwitch.md
new file mode 100644
index 00000000..353c4274
--- /dev/null
+++ b/dwm.suckless.org/patches/schemeSwitch.md
_AT_@ -0,0 +1,31 @@
+schemeSwitch
+=====
+
+Description
+-----------
+
+[Solarized](
http://ethanschoonover.com/solarized) is a color scheme by Ethan
+Schoonover which exists in a dark and a light variant.
+
+This patch allows you defining more then one color-Scheme in the colors array in
+config.def.h (or config.h) and cycle through the schemes by schemeCycle() function
+(bound to Mod+Shift+z) and toggle between corresponding light and dark schemes
+with schemeToggle() function (bound to Mod+Shift+t).
+
+In the example config.def.h there are first defined the colors for the dark variant of
+solarized theme, after that the colors for the light variant, and then the original dwm
+colorscheme, wich has no corresponding light scheme. If the last one is selected
+shemeToggle() will do nothing, but one can cycle to the dark scheme (or the light one)
+and then toggle between light and dark. If there where colors defined after the original
+scheme, then schemeToggle() would toggle between original and the consecutive.
+
+
+Download
+--------
+ * [dwm-schemeSwitch-20170804-ceac8c9.diff](dwm-schemeSwitch-20170804-ceac8c9.diff)
+
+
+Authors
+-------
+
+ * Aaron Strahlberger - <aaron.strahlberger_AT_posteo.de>
Received on Fri Aug 04 2017 - 21:38:10 CEST