Adding monochrome patch and anysize-nobar patch

This commit is contained in:
bakkeby 2020-10-23 10:14:00 +02:00
parent 8faa9f3c93
commit ef994f3e6d
4 changed files with 55 additions and 1 deletions

View File

@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog: ### Changelog:
2020-10-23 - Added the monochrome patch
2020-08-08 - Re-added the visualbell patch 2020-08-08 - Re-added the visualbell patch
2020-06-26 - Added the single drawable buffer patch as per the FAQ in order to get w3m images to display 2020-06-26 - Added the single drawable buffer patch as per the FAQ in order to get w3m images to display
@ -53,6 +55,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [anysize](https://st.suckless.org/patches/anysize/) - [anysize](https://st.suckless.org/patches/anysize/)
- allows st to reize to any pixel size rather than snapping to character width / height - allows st to reize to any pixel size rather than snapping to character width / height
- [anysize_nobar](https://github.com/connor-brooks/st-anysize-nobar)
- a patch that aims to prevent black bars being drawn on the edges of st terminals using the anysize patch
- [bold-is-not-bright](https://st.suckless.org/patches/bold-is-not-bright/) - [bold-is-not-bright](https://st.suckless.org/patches/bold-is-not-bright/)
- by default bold text is rendered with a bold font in the bright variant of the current color - by default bold text is rendered with a bold font in the bright variant of the current color
- this patch makes bold text rendered simply as bold, leaving the color unaffected - this patch makes bold text rendered simply as bold, leaving the color unaffected
@ -108,6 +113,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [ligatures](https://st.suckless.org/patches/ligatures/) - [ligatures](https://st.suckless.org/patches/ligatures/)
- adds support for drawing ligatures using the Harfbuzz library to transform original text of a single line to a list of glyphs with ligatures included - adds support for drawing ligatures using the Harfbuzz library to transform original text of a single line to a list of glyphs with ligatures included
- [monochrome](https://www.reddit.com/r/suckless/comments/ixbx6z/how_to_use_black_and_white_only_for_st/)
- makes st ignore terminal color attributes to make for a monochrome look
- [newterm](https://st.suckless.org/patches/newterm/) - [newterm](https://st.suckless.org/patches/newterm/)
- allows you to spawn a new st terminal using Ctrl-Shift-Return - allows you to spawn a new st terminal using Ctrl-Shift-Return
- it will have the same CWD (current working directory) as the original st instance - it will have the same CWD (current working directory) as the original st instance

View File

@ -21,6 +21,15 @@
*/ */
#define ANYSIZE_PATCH 0 #define ANYSIZE_PATCH 0
/* This patch aims to prevent black bars being drawn on the edges of st terminals using the anysize
* patch. This generally only occurs when the terminal background color doesn't match the colors
* set in st's config.h file, for example when using terminal theming scripts such as base16.
* (I have not found this to be working, but adding for reference. May reduce flickering on
* terminal resizes.)
* https://github.com/connor-brooks/st-anysize-nobar
*/
#define ANYSIZE_NOBAR_PATCH 0
/* By default bold text is rendered with a bold font in the bright variant of the current color. /* By default bold text is rendered with a bold font in the bright variant of the current color.
* This patch makes bold text rendered simply as bold, leaving the color unaffected. * This patch makes bold text rendered simply as bold, leaving the color unaffected.
* https://st.suckless.org/patches/bold-is-not-bright/ * https://st.suckless.org/patches/bold-is-not-bright/
@ -137,6 +146,12 @@
*/ */
#define LIGATURES_PATCH 0 #define LIGATURES_PATCH 0
/* This patch makes st ignore terminal color attributes by forcing display of the default
* foreground and background colors only - making for a monochrome look. Idea ref.
* https://www.reddit.com/r/suckless/comments/ixbx6z/how_to_use_black_and_white_only_for_st/
*/
#define MONOCHROME_PATCH 0
/* This patch allows you to spawn a new st terminal using Ctrl-Shift-Return. It will have the /* This patch allows you to spawn a new st terminal using Ctrl-Shift-Return. It will have the
* same CWD (current working directory) as the original st instance. * same CWD (current working directory) as the original st instance.
* https://st.suckless.org/patches/newterm/ * https://st.suckless.org/patches/newterm/

24
st.c
View File

@ -1576,27 +1576,51 @@ tsetattr(int *attr, int l)
break; break;
case 38: case 38:
if ((idx = tdefcolor(attr, &i, l)) >= 0) if ((idx = tdefcolor(attr, &i, l)) >= 0)
#if MONOCHROME_PATCH
term.c.attr.fg = defaultfg;
#else
term.c.attr.fg = idx; term.c.attr.fg = idx;
#endif // MONOCHROME_PATCH
break; break;
case 39: case 39:
term.c.attr.fg = defaultfg; term.c.attr.fg = defaultfg;
break; break;
case 48: case 48:
if ((idx = tdefcolor(attr, &i, l)) >= 0) if ((idx = tdefcolor(attr, &i, l)) >= 0)
#if MONOCHROME_PATCH
term.c.attr.bg = 0;
#else
term.c.attr.bg = idx; term.c.attr.bg = idx;
#endif // MONOCHROME_PATCH
break; break;
case 49: case 49:
term.c.attr.bg = defaultbg; term.c.attr.bg = defaultbg;
break; break;
default: default:
if (BETWEEN(attr[i], 30, 37)) { if (BETWEEN(attr[i], 30, 37)) {
#if MONOCHROME_PATCH
term.c.attr.fg = defaultfg;
#else
term.c.attr.fg = attr[i] - 30; term.c.attr.fg = attr[i] - 30;
#endif // MONOCHROME_PATCH
} else if (BETWEEN(attr[i], 40, 47)) { } else if (BETWEEN(attr[i], 40, 47)) {
#if MONOCHROME_PATCH
term.c.attr.bg = 0;
#else
term.c.attr.bg = attr[i] - 40; term.c.attr.bg = attr[i] - 40;
#endif // MONOCHROME_PATCH
} else if (BETWEEN(attr[i], 90, 97)) { } else if (BETWEEN(attr[i], 90, 97)) {
#if MONOCHROME_PATCH
term.c.attr.fg = defaultfg;
#else
term.c.attr.fg = attr[i] - 90 + 8; term.c.attr.fg = attr[i] - 90 + 8;
#endif // MONOCHROME_PATCH
} else if (BETWEEN(attr[i], 100, 107)) { } else if (BETWEEN(attr[i], 100, 107)) {
#if MONOCHROME_PATCH
term.c.attr.bg = 0;
#else
term.c.attr.bg = attr[i] - 100 + 8; term.c.attr.bg = attr[i] - 100 + 8;
#endif // MONOCHROME_PATCH
} else { } else {
fprintf(stderr, fprintf(stderr,
"erresc(default): gfx attr %d unknown\n", "erresc(default): gfx attr %d unknown\n",

9
x.c
View File

@ -1752,7 +1752,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
xclear(winx, winy + win.ch, winx + width, win.h); xclear(winx, winy + win.ch, winx + width, win.h);
#endif // ANYSIZE_PATCH #endif // ANYSIZE_PATCH
/* Clean up the region we want to draw to. */ // /* Clean up the region we want to draw to. */
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
/* Set the clip region because Xft is sometimes dirty. */ /* Set the clip region because Xft is sometimes dirty. */
@ -2394,6 +2394,13 @@ run(void)
} }
} }
#if ANYSIZE_NOBAR_PATCH
/* Refresh before drawing */
cresize(0, 0);
redraw();
xhints();
#endif // ANYSIZE_NOBAR_PATCH
#if VISUALBELL_1_PATCH #if VISUALBELL_1_PATCH
if (bellon) { if (bellon) {
bellon++; bellon++;