st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit a44ac5937fc2d6f9714a7cd3364219fcfb15c8a2
parent 8c8bace91ce9f4d92f9f7e500d75b768edd28e3e
Author: bakkeby <bakkeby@gmail.com>
Date:   Sat,  8 May 2021 16:50:06 +0200

Adding osc_10_11_12_2 patch ref. #21

Diffstat:
MREADME.md | 10+++++++++-
Mpatches.def.h | 10++++++++++
Mst.c | 35++++++++++++++++++++++++++++++++++-
3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -15,7 +15,7 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the ### Changelog: -2021-05-08 - Added blinking cursor, undercurl, desktopentry and netwmicon patches +2021-05-08 - Added blinking cursor, undercurl, desktopentry, netwmicon and osc_10_11_12_2 patches 2021-05-07 - Added xresources reload patch @@ -154,6 +154,14 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the - [open-copied-url](https://st.suckless.org/patches/open_copied_url/) - open contents of the clipboard in a user-defined browser + - [osc_10_11_12_2](https://st.suckless.org/patches/osc_10_11_12_2/) + - this patch adds support for OSC escape sequences 10, 11, and 12 in the way they are + implemented in most other terminals (e.g libvte, kitty) + - specifically it differs from [osc_10_11_12](https://st.suckless.org/patches/osc_10_11_12/) + in that it treats the background and foreground colors as distinct from palette colours 01 + and 07 in order to facilitate the use of theme setting scripts like + [theme.sh](https://github.com/lemnos/theme.sh) which expect these colours to be distinct + - [relativeborder](https://st.suckless.org/patches/relativeborder/) - allows you to specify a border that is relative in size to the width of a cell in the terminal diff --git a/patches.def.h b/patches.def.h @@ -186,6 +186,16 @@ */ #define OPENCOPIED_PATCH 0 +/* This patch adds support for OSC escape sequences 10, 11 and 12 that modify the background, + * foreground and cursor colors in the way they are implemented in most other terminals + * (e.g libvte, kitty). Specifically it differs from https://st.suckless.org/patches/osc_10_11_12/ + * in that it treats the background and foreground colors as distinct from palette colours + * 01 and 07 in order to facilitate the use of theme setting scripts like theme.sh + * (https://github.com/lemnos/theme.sh) which expect these colours to be distinct. + * https://st.suckless.org/patches/osc_10_11_12_2/ + */ +#define OSC_10_11_12_2_PATCH 0 + /* This patch allows you to specify a border that is relative in size to the width of a cell * in the terminal. * https://st.suckless.org/patches/relativeborder/ diff --git a/st.c b/st.c @@ -2140,10 +2140,43 @@ strhandle(void) } } return; - case 4: /* color set */ case 10: /* foreground set */ + #if OSC_10_11_12_2_PATCH + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultfg, p)) + fprintf(stderr, "erresc: invalid foreground color %d\n", p); + else + redraw(); + break; + #endif // OSC_10_11_12_2_PATCH case 11: /* background set */ + #if OSC_10_11_12_2_PATCH + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultbg, p)) + fprintf(stderr, "erresc: invalid background color %d\n", p); + else + redraw(); + break; + #endif // OSC_10_11_12_2_PATCH case 12: /* cursor color */ + #if OSC_10_11_12_2_PATCH + if (narg < 2) + break; + + p = strescseq.args[1]; + if (xsetcolorname(defaultcs, p)) + fprintf(stderr, "erresc: invalid cursor color %d\n", p); + else + redraw(); + break; + #endif // OSC_10_11_12_2_PATCH + case 4: /* color set */ if ((par == 4 && narg < 3) || narg < 2) break; p = strescseq.args[((par == 4) ? 2 : 1)];