From c6c7c8541dde87b87d492465a1af3c585e5e19a0 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Wed, 13 May 2020 14:52:22 -0400 Subject: Added OSC patch and changes xsetcolorname for live reloading pywal colors while keeping transparency --- st.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 192360b..618e11b 100644 --- a/st.c +++ b/st.c @@ -1943,12 +1943,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 */ -- cgit v1.2.3 From 24fa39b8618887a0e6bfeda1b83391361887cc21 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Wed, 13 May 2020 17:06:41 -0400 Subject: added the xclearwin patch to fix dirty borders after changing colors --- config.h | 2 +- st.c | 2 ++ win.h | 1 + x.c | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'st.c') diff --git a/config.h b/config.h index c8921bd..eab1df9 100644 --- a/config.h +++ b/config.h @@ -108,7 +108,7 @@ char *termname = "st-256color"; unsigned int tabspaces = 8; /* bg opacity */ -float alpha = 0.8; +float alpha = 0.9; /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { diff --git a/st.c b/st.c index 618e11b..0e5e3f5 100644 --- a/st.c +++ b/st.c @@ -1970,6 +1970,8 @@ strhandle(void) * TODO if defaultbg color is changed, borders * are dirty */ + if (j == defaultbg) + xclearwin(); redraw(); } return; diff --git a/win.h b/win.h index a6ef1b9..d7b4980 100644 --- a/win.h +++ b/win.h @@ -37,3 +37,4 @@ void xsetpointermotion(int); void xsetsel(char *); int xstartdraw(void); void xximspot(int, int); +void xclearwin(void); diff --git a/x.c b/x.c index 47e4dea..55f4a61 100644 --- a/x.c +++ b/x.c @@ -831,6 +831,13 @@ xclear(int x1, int y1, int x2, int y2) x1, y1, x2-x1, y2-y1); } +void +xclearwin(void) +{ + xclear(0, 0, win.w, win.h); +} + + void xhints(void) { -- cgit v1.2.3