From c6c7c8541dde87b87d492465a1af3c585e5e19a0 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Wed, 13 May 2020 14:52:22 -0400 Subject: [PATCH 1/5] Added OSC patch and changes xsetcolorname for live reloading pywal colors while keeping transparency --- config.h | 4 ++-- st.c | 17 ++++++++++++++--- st.h | 1 + x.c | 2 ++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/config.h b/config.h index 696f634..c8921bd 100644 --- a/config.h +++ b/config.h @@ -143,8 +143,8 @@ static const char *colorname[] = { */ unsigned int defaultfg = 259; unsigned int defaultbg = 258; -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 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 */ diff --git a/st.h b/st.h index 9bf307e..33cc5d4 100644 --- a/st.h +++ b/st.h @@ -140,6 +140,7 @@ extern char *termname; extern unsigned int tabspaces; extern unsigned int defaultfg; extern unsigned int defaultbg; +extern unsigned int defaultcs; extern const int boxdraw, boxdraw_bold, boxdraw_braille; extern float alpha; extern MouseKey mkeys[]; diff --git a/x.c b/x.c index 8be4a04..47e4dea 100644 --- a/x.c +++ b/x.c @@ -814,6 +814,8 @@ xsetcolorname(int x, const char *name) XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]); dc.col[x] = ncolor; + if (x == defaultbg) + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); return 0; } From 24fa39b8618887a0e6bfeda1b83391361887cc21 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Wed, 13 May 2020 17:06:41 -0400 Subject: [PATCH 2/5] 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(-) 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) { From 05708c89c3aec1615f03171d205fd0d2573f635c Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Wed, 13 May 2020 17:10:44 -0400 Subject: [PATCH 3/5] Reverted bg opacity back to 0.8 for upstream merge --- config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.h b/config.h index eab1df9..c8921bd 100644 --- a/config.h +++ b/config.h @@ -108,7 +108,7 @@ char *termname = "st-256color"; unsigned int tabspaces = 8; /* bg opacity */ -float alpha = 0.9; +float alpha = 0.8; /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { From 069fed73daf8f12ff1993d9ee7d58958b8600812 Mon Sep 17 00:00:00 2001 From: Jakub Rekowski Date: Sun, 17 May 2020 10:36:21 +0200 Subject: [PATCH 4/5] Added info about include X11 in ubuntu. Added comment with X11 path in systems based on ubuntu. --- config.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.mk b/config.mk index eba98c3..1635264 100644 --- a/config.mk +++ b/config.mk @@ -10,6 +10,10 @@ MANPREFIX = $(PREFIX)/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib +# include X11 in Ubuntu +# X11INC = /usr/include/X11R6 +# X11LIB = /usr/lib/X11R6 + PKG_CONFIG = pkg-config # includes and libs From 1d6423104722558c3be13fffc5475405c4d9a519 Mon Sep 17 00:00:00 2001 From: LoganDungeon Date: Sun, 17 May 2020 13:55:24 +0200 Subject: [PATCH 5/5] renamed compton to picom Just a small change: compton recently was renamed to picom --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 95238b6..811f446 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Obviously, `make` is required to build. `fontconfig` is required for the default On OpenBSD, be sure to edit `config.mk` first and remove `-lrt` from the `$LIBS` before compiling. -Be sure to have a composite manager (`xcompmgr`, `compton`, etc.) running if you want transparency. +Be sure to have a composite manager (`xcompmgr`, `picom`, etc.) running if you want transparency. ## How to configure dynamically with Xresources