Re: [wiki] [sites] Rename solarswap patch || FRIGN
Whoops, just saw this.
The solarized-both patch is more 'intrusive' in that it modifies st.c, while the
dark/light patches only modify config.h. So I could see why someone might want
to keep them separate.
On Sun 07/10/16 08:36PM, git_AT_suckless.org wrote:
> commit 40ef2a0ff74db19c105a98c7a80b8f64ca93a846
> Author: FRIGN <dev_AT_frign.de>
> Date: Sun Jul 10 20:35:40 2016 +0200
>
> Rename solarswap patch
>
> Maybe also as a TODO it might be cool to merge all three patches
> into one, i.e. both color schemes and a small flag allowing either
> light, dark or both to be set (and toggable using F6).
>
> diff --git a/st.suckless.org/patches/solarized.md b/st.suckless.org/patches/solarized.md
> index d2bbe9f..5b86adb 100644
> --- a/st.suckless.org/patches/solarized.md
> +++ b/st.suckless.org/patches/solarized.md
> _AT_@ -51,9 +51,9 @@ or the dark color scheme:
> * [st-solarized-dark-0.6.diff](st-solarized-dark-0.6.diff)
> * [st-solarized-dark-git-20160620-528241a.diff](st-solarized-dark-git-20160620-528241a.diff)
>
> -*Both (Swap between light/dark with F6)*:
> +*Both (swap between light/dark with F6)*:
>
> - * [st-solarswap-20160709-528241a.diff](st-solarswap-20160709-528241a.diff)
> + * [st-solarized-both-git-20160709-528241a.diff](st-solarized-both-git-20160710-528241a.diff)
>
>
> Authors
> _AT_@ -61,4 +61,4 @@ Authors
>
> * Nils Reuße - nilsreusse_AT_gmail.com
> * Laslo Hunhold - dev_AT_frign.de (0.5, 0.6, git ports)
> - * Ryan Roden-Corrent - ryan_AT_rcorre.net (solarswap)
> + * Ryan Roden-Corrent - ryan_AT_rcorre.net (both)
> diff --git a/st.suckless.org/patches/st-solarized-both-git-20160710-528241a.diff b/st.suckless.org/patches/st-solarized-both-git-20160710-528241a.diff
> new file mode 100644
> index 0000000..b5f0a12
> --- /dev/null
> +++ b/st.suckless.org/patches/st-solarized-both-git-20160710-528241a.diff
> _AT_@ -0,0 +1,189 @@
> +diff --git a/config.def.h b/config.def.h
> +index 9e61010..064f5e9 100644
> +--- a/config.def.h
> ++++ b/config.def.h
> +_AT_@ -69,42 +69,54 @@ static unsigned int tabspaces = 8;
> +
> + /* Terminal colors (16 first used in escape sequence) */
> + static const char *colorname[] = {
> +- /* 8 normal colors */
> +- "black",
> +- "red3",
> +- "green3",
> +- "yellow3",
> +- "blue2",
> +- "magenta3",
> +- "cyan3",
> +- "gray90",
> +-
> +- /* 8 bright colors */
> +- "gray50",
> +- "red",
> +- "green",
> +- "yellow",
> +- "#5c5cff",
> +- "magenta",
> +- "cyan",
> +- "white",
> +-
> +- [255] = 0,
> +-
> +- /* more colors can be added after 255 to use with DefaultXX */
> +- "#cccccc",
> +- "#555555",
> ++ /* solarized dark */
> ++ "#073642", /* 0: black */
> ++ "#dc322f", /* 1: red */
> ++ "#859900", /* 2: green */
> ++ "#b58900", /* 3: yellow */
> ++ "#268bd2", /* 4: blue */
> ++ "#d33682", /* 5: magenta */
> ++ "#2aa198", /* 6: cyan */
> ++ "#eee8d5", /* 7: white */
> ++ "#002b36", /* 8: brblack */
> ++ "#cb4b16", /* 9: brred */
> ++ "#586e75", /* 10: brgreen */
> ++ "#657b83", /* 11: bryellow */
> ++ "#839496", /* 12: brblue */
> ++ "#6c71c4", /* 13: brmagenta*/
> ++ "#93a1a1", /* 14: brcyan */
> ++ "#fdf6e3", /* 15: brwhite */
> + };
> +
> ++/* Terminal colors for alternate (light) palette */
> ++static const char *altcolorname[] = {
> ++ /* solarized light */
> ++ "#eee8d5", /* 0: black */
> ++ "#dc322f", /* 1: red */
> ++ "#859900", /* 2: green */
> ++ "#b58900", /* 3: yellow */
> ++ "#268bd2", /* 4: blue */
> ++ "#d33682", /* 5: magenta */
> ++ "#2aa198", /* 6: cyan */
> ++ "#073642", /* 7: white */
> ++ "#fdf6e3", /* 8: brblack */
> ++ "#cb4b16", /* 9: brred */
> ++ "#93a1a1", /* 10: brgreen */
> ++ "#839496", /* 11: bryellow */
> ++ "#657b83", /* 12: brblue */
> ++ "#6c71c4", /* 13: brmagenta*/
> ++ "#586e75", /* 14: brcyan */
> ++ "#002b36", /* 15: brwhite */
> ++};
> +
> + /*
> + * Default colors (colorname index)
> + * foreground, background, cursor, reverse cursor
> + */
> +-static unsigned int defaultfg = 7;
> +-static unsigned int defaultbg = 0;
> +-static unsigned int defaultcs = 256;
> +-static unsigned int defaultrcs = 257;
> ++static unsigned int defaultfg = 12;
> ++static unsigned int defaultbg = 8;
> ++static unsigned int defaultcs = 14;
> ++static unsigned int defaultrcs = 15;
> +
> + /*
> + * Default shape of cursor
> +_AT_@ -157,6 +169,7 @@ static Shortcut shortcuts[] = {
> + { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
> + { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
> + { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
> ++ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
> + };
> +
> + /*
> +diff --git a/st.c b/st.c
> +index 2594c65..b4a3089 100644
> +--- a/st.c
> ++++ b/st.c
> +_AT_@ -328,6 +328,7 @@ typedef struct {
> + static void clipcopy(const Arg *);
> + static void clippaste(const Arg *);
> + static void numlock(const Arg *);
> ++static void swapcolors(const Arg *);
> + static void selpaste(const Arg *);
> + static void xzoom(const Arg *);
> + static void xzoomabs(const Arg *);
> +_AT_@ -355,7 +356,7 @@ typedef struct {
> +
> + /* Drawing Context */
> + typedef struct {
> +- Color col[MAX(LEN(colorname), 256)];
> ++ Color col[MAX(MAX(LEN(colorname), LEN(altcolorname)), 256)];
> + Font font, bfont, ifont, ibfont;
> + GC gc;
> + } DC;
> +_AT_@ -533,6 +534,8 @@ static char *opt_name = NULL;
> + static char *opt_title = NULL;
> + static int oldbutton = 3; /* button event on startup: 3 = release */
> +
> ++static int usealtcolors = 0; /* 1 to use alternate palette */
> ++
> + static char *usedfont = NULL;
> + static double usedfontsize = 0;
> + static double defaultfontsize = 0;
> +_AT_@ -3148,6 +3151,11 @@ sixd_to_16bit(int x)
> + return x == 0 ? 0 : 0x3737 + 0x2828 * x;
> + }
> +
> ++const char* getcolorname(int i)
> ++{
> ++ return (usealtcolors) ? altcolorname[i] : colorname[i];
> ++}
> ++
> + int
> + xloadcolor(int i, const char *name, Color *ncolor)
> + {
> +_AT_@ -3166,7 +3174,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
> + return XftColorAllocValue(xw.dpy, xw.vis,
> + xw.cmap, &color, ncolor);
> + } else
> +- name = colorname[i];
> ++ name = getcolorname(i);
> + }
> +
> + return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
> +_AT_@ -3186,8 +3194,8 @@ xloadcols(void)
> +
> + for (i = 0; i < LEN(dc.col); i++)
> + if (!xloadcolor(i, NULL, &dc.col[i])) {
> +- if (colorname[i])
> +- die("Could not allocate color '%s'
> ", colorname[i]);
> ++ if (getcolorname(i))
> ++ die("Could not allocate color '%s'
> ", getcolorname(i));
> + else
> + die("Could not allocate color %d
> ", i);
> + }
> +_AT_@ -3514,13 +3522,13 @@ xinit(void)
> + cursor = XCreateFontCursor(xw.dpy, mouseshape);
> + XDefineCursor(xw.dpy, xw.win, cursor);
> +
> +- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
> ++ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
> + xmousefg.red = 0xffff;
> + xmousefg.green = 0xffff;
> + xmousefg.blue = 0xffff;
> + }
> +
> +- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
> ++ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
> + xmousebg.red = 0x0000;
> + xmousebg.green = 0x0000;
> + xmousebg.blue = 0x0000;
> +_AT_@ -4074,6 +4082,14 @@ numlock(const Arg *dummy)
> + term.numlock ^= 1;
> + }
> +
> ++void
> ++swapcolors(const Arg *dummy)
> ++{
> ++ usealtcolors = !usealtcolors;
> ++ xloadcols();
> ++ redraw();
> ++}
> ++
> + char*
> + kmap(KeySym k, uint state)
> + {
> diff --git a/st.suckless.org/patches/st-solarswap-20160709-528241a.diff b/st.suckless.org/patches/st-solarswap-20160709-528241a.diff
> deleted file mode 100644
> index b5f0a12..0000000
> --- a/st.suckless.org/patches/st-solarswap-20160709-528241a.diff
> +++ /dev/null
> _AT_@ -1,189 +0,0 @@
> -diff --git a/config.def.h b/config.def.h
> -index 9e61010..064f5e9 100644
> ---- a/config.def.h
> -+++ b/config.def.h
> -_AT_@ -69,42 +69,54 @@ static unsigned int tabspaces = 8;
> -
> - /* Terminal colors (16 first used in escape sequence) */
> - static const char *colorname[] = {
> -- /* 8 normal colors */
> -- "black",
> -- "red3",
> -- "green3",
> -- "yellow3",
> -- "blue2",
> -- "magenta3",
> -- "cyan3",
> -- "gray90",
> --
> -- /* 8 bright colors */
> -- "gray50",
> -- "red",
> -- "green",
> -- "yellow",
> -- "#5c5cff",
> -- "magenta",
> -- "cyan",
> -- "white",
> --
> -- [255] = 0,
> --
> -- /* more colors can be added after 255 to use with DefaultXX */
> -- "#cccccc",
> -- "#555555",
> -+ /* solarized dark */
> -+ "#073642", /* 0: black */
> -+ "#dc322f", /* 1: red */
> -+ "#859900", /* 2: green */
> -+ "#b58900", /* 3: yellow */
> -+ "#268bd2", /* 4: blue */
> -+ "#d33682", /* 5: magenta */
> -+ "#2aa198", /* 6: cyan */
> -+ "#eee8d5", /* 7: white */
> -+ "#002b36", /* 8: brblack */
> -+ "#cb4b16", /* 9: brred */
> -+ "#586e75", /* 10: brgreen */
> -+ "#657b83", /* 11: bryellow */
> -+ "#839496", /* 12: brblue */
> -+ "#6c71c4", /* 13: brmagenta*/
> -+ "#93a1a1", /* 14: brcyan */
> -+ "#fdf6e3", /* 15: brwhite */
> - };
> -
> -+/* Terminal colors for alternate (light) palette */
> -+static const char *altcolorname[] = {
> -+ /* solarized light */
> -+ "#eee8d5", /* 0: black */
> -+ "#dc322f", /* 1: red */
> -+ "#859900", /* 2: green */
> -+ "#b58900", /* 3: yellow */
> -+ "#268bd2", /* 4: blue */
> -+ "#d33682", /* 5: magenta */
> -+ "#2aa198", /* 6: cyan */
> -+ "#073642", /* 7: white */
> -+ "#fdf6e3", /* 8: brblack */
> -+ "#cb4b16", /* 9: brred */
> -+ "#93a1a1", /* 10: brgreen */
> -+ "#839496", /* 11: bryellow */
> -+ "#657b83", /* 12: brblue */
> -+ "#6c71c4", /* 13: brmagenta*/
> -+ "#586e75", /* 14: brcyan */
> -+ "#002b36", /* 15: brwhite */
> -+};
> -
> - /*
> - * Default colors (colorname index)
> - * foreground, background, cursor, reverse cursor
> - */
> --static unsigned int defaultfg = 7;
> --static unsigned int defaultbg = 0;
> --static unsigned int defaultcs = 256;
> --static unsigned int defaultrcs = 257;
> -+static unsigned int defaultfg = 12;
> -+static unsigned int defaultbg = 8;
> -+static unsigned int defaultcs = 14;
> -+static unsigned int defaultrcs = 15;
> -
> - /*
> - * Default shape of cursor
> -_AT_@ -157,6 +169,7 @@ static Shortcut shortcuts[] = {
> - { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
> - { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
> - { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
> -+ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
> - };
> -
> - /*
> -diff --git a/st.c b/st.c
> -index 2594c65..b4a3089 100644
> ---- a/st.c
> -+++ b/st.c
> -_AT_@ -328,6 +328,7 @@ typedef struct {
> - static void clipcopy(const Arg *);
> - static void clippaste(const Arg *);
> - static void numlock(const Arg *);
> -+static void swapcolors(const Arg *);
> - static void selpaste(const Arg *);
> - static void xzoom(const Arg *);
> - static void xzoomabs(const Arg *);
> -_AT_@ -355,7 +356,7 @@ typedef struct {
> -
> - /* Drawing Context */
> - typedef struct {
> -- Color col[MAX(LEN(colorname), 256)];
> -+ Color col[MAX(MAX(LEN(colorname), LEN(altcolorname)), 256)];
> - Font font, bfont, ifont, ibfont;
> - GC gc;
> - } DC;
> -_AT_@ -533,6 +534,8 @@ static char *opt_name = NULL;
> - static char *opt_title = NULL;
> - static int oldbutton = 3; /* button event on startup: 3 = release */
> -
> -+static int usealtcolors = 0; /* 1 to use alternate palette */
> -+
> - static char *usedfont = NULL;
> - static double usedfontsize = 0;
> - static double defaultfontsize = 0;
> -_AT_@ -3148,6 +3151,11 @@ sixd_to_16bit(int x)
> - return x == 0 ? 0 : 0x3737 + 0x2828 * x;
> - }
> -
> -+const char* getcolorname(int i)
> -+{
> -+ return (usealtcolors) ? altcolorname[i] : colorname[i];
> -+}
> -+
> - int
> - xloadcolor(int i, const char *name, Color *ncolor)
> - {
> -_AT_@ -3166,7 +3174,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
> - return XftColorAllocValue(xw.dpy, xw.vis,
> - xw.cmap, &color, ncolor);
> - } else
> -- name = colorname[i];
> -+ name = getcolorname(i);
> - }
> -
> - return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
> -_AT_@ -3186,8 +3194,8 @@ xloadcols(void)
> -
> - for (i = 0; i < LEN(dc.col); i++)
> - if (!xloadcolor(i, NULL, &dc.col[i])) {
> -- if (colorname[i])
> -- die("Could not allocate color '%s'
> ", colorname[i]);
> -+ if (getcolorname(i))
> -+ die("Could not allocate color '%s'
> ", getcolorname(i));
> - else
> - die("Could not allocate color %d
> ", i);
> - }
> -_AT_@ -3514,13 +3522,13 @@ xinit(void)
> - cursor = XCreateFontCursor(xw.dpy, mouseshape);
> - XDefineCursor(xw.dpy, xw.win, cursor);
> -
> -- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
> -+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
> - xmousefg.red = 0xffff;
> - xmousefg.green = 0xffff;
> - xmousefg.blue = 0xffff;
> - }
> -
> -- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
> -+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
> - xmousebg.red = 0x0000;
> - xmousebg.green = 0x0000;
> - xmousebg.blue = 0x0000;
> -_AT_@ -4074,6 +4082,14 @@ numlock(const Arg *dummy)
> - term.numlock ^= 1;
> - }
> -
> -+void
> -+swapcolors(const Arg *dummy)
> -+{
> -+ usealtcolors = !usealtcolors;
> -+ xloadcols();
> -+ redraw();
> -+}
> -+
> - char*
> - kmap(KeySym k, uint state)
> - {
>
>
Received on Sun Jul 17 2016 - 02:58:25 CEST
This archive was generated by hypermail 2.3.0
: Sun Jul 17 2016 - 03:00:18 CEST