[wiki] [sites] Support for OSC escape sequences 10, 11 and 12 || Christian Tenllado

From: <git_AT_suckless.org>
Date: Mon, 04 May 2020 19:41:04 +0200

commit e8d1090443781837f3c0d7693a97e5a3dce49643
Author: Christian Tenllado <ctenllado_AT_gmail.com>
Date: Mon May 4 19:39:45 2020 +0200

    Support for OSC escape sequences 10, 11 and 12
    
    These modify the bg, fg and cursor colors. To decouple them from the
    palette colors you can select entries in the colorname table after the 255
    position for defaultfg, defaultbg and defaultcs.

diff --git a/st.suckless.org/patches/osc_10_11_12/index.md b/st.suckless.org/patches/osc_10_11_12/index.md
new file mode 100644
index 00000000..ea4ba9c2
--- /dev/null
+++ b/st.suckless.org/patches/osc_10_11_12/index.md
_AT_@ -0,0 +1,18 @@
+color\_schemes
+==============
+
+Description
+-----------
+This patch adds support for OSC escape sequences 10, 11 and 12, that modify the
+bg, fg and cursor colors. To decouple them from the palette you can select
+entries from the colorname table after the 255 position for defaultfg, defaultbg
+and defaultcs.
+
+Download
+--------
+* [st-osc\_10\_11\_12-20200418-66520e1.diff](st-osc_10_11_12-20200418-66520e1.diff)
+
+
+Authors
+-------
+* Christian Tenllado - <ctenllado at gmail dot com>
diff --git a/st.suckless.org/patches/osc_10_11_12/st-osc_10_11_12-20200418-66520e1.diff b/st.suckless.org/patches/osc_10_11_12/st-osc_10_11_12-20200418-66520e1.diff
new file mode 100644
index 00000000..5a4e3413
--- /dev/null
+++ b/st.suckless.org/patches/osc_10_11_12/st-osc_10_11_12-20200418-66520e1.diff
_AT_@ -0,0 +1,72 @@
+From 66520e1c3b0a6f30ce1cde033a1aec04e5a0f1a2 Mon Sep 17 00:00:00 2001
+From: Christian Tenllado <ctenllado_AT_gmail.com>
+Date: Sat, 18 Apr 2020 09:26:46 +0200
+Subject: [PATCH] OSC 10/11/12 fg, bg and cursor colors
+
+Support for OSC escape sequences 10, 11 and 12 to modify the bg, fg and
+cursor colors. I selected entries in the colorname table after the 255
+position for defaultfg, defaultbg and defaultcs
+---
+ config.def.h | 4 ++--
+ st.c | 17 ++++++++++++++---
+ st.h | 1 +
+ 3 files changed, 17 insertions(+), 5 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 546edda..7d20fdf 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -118,8 +118,8 @@ static const char *colorname[] = {
+ */
+ unsigned int defaultfg = 7;
+ unsigned int defaultbg = 0;
+-static unsigned int defaultcs = 256;
+-static unsigned int defaultrcs = 257;
++unsigned int defaultcs = 256;
++unsigned int defaultrcs = 257;
+
+ /*
+ * Default shape of cursor
+diff --git a/st.c b/st.c
+index 3e48410..ec7970c 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -1862,12 +1862,23 @@ strhandle(void)
+ }
+ return;
+ case 4: /* color set */
+- if (narg < 3)
++ case 10: /* foreground set */
++ case 11: /* background set */
++ case 12: /* cursor color */
++ if ((par == 4 && narg < 3) || narg < 2)
+ break;
+- p = strescseq.args[2];
++ p = strescseq.args[((par == 4) ? 2 : 1)];
+ /* FALLTHROUGH */
+ case 104: /* color reset, here p = NULL */
+- j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
++ if (par == 10)
++ j = defaultfg;
++ else if (par == 11)
++ j = defaultbg;
++ else if (par == 12)
++ j = defaultcs;
++ else
++ j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
++
+ if (xsetcolorname(j, p)) {
+ if (par == 104 && narg <= 1)
+ return; /* color reset without parameter */
+diff --git a/st.h b/st.h
+index a1928ca..bd79875 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -121,3 +121,4 @@ extern char *termname;
+ extern unsigned int tabspaces;
+ extern unsigned int defaultfg;
+ extern unsigned int defaultbg;
++extern unsigned int defaultcs;
+--
+2.20.1
+
Received on Mon May 04 2020 - 19:41:04 CEST

This archive was generated by hypermail 2.3.0 : Mon May 04 2020 - 19:48:54 CEST