summaryrefslogtreecommitdiff
path: root/patches/8st-dynamic-cursor-color-0.8.4.diff
diff options
context:
space:
mode:
authorSaumit Dinesan <79687674+Saumit-D@users.noreply.github.com>2021-11-14 00:28:46 +0530
committerGitHub <noreply@github.com>2021-11-14 00:28:46 +0530
commit0eea036018c78b371b4feca6cd86b02cc2bdd0fc (patch)
tree4b82ba389527f6d7a1a600ec1673103b3e83bd83 /patches/8st-dynamic-cursor-color-0.8.4.diff
parentf091c4a5667ae62e31f54f2d6b4fe2d8b6b1f557 (diff)
Solves the missing cursor issue
pywal would set the st cursor the same color as the background of the terminal making it difficult to firstly identify where the cursor really is and secondly if it were on a text, the letter would appear as a blank space than the color of the text changing signifying that the cursor has engulfed the letter. really cool patch thank you suckless devs for solving this issue which I couldnt find a workaround for because pywal/xresources state my cursor color to be some white/grey hex color code when it clearly is not.
Diffstat (limited to 'patches/8st-dynamic-cursor-color-0.8.4.diff')
-rw-r--r--patches/8st-dynamic-cursor-color-0.8.4.diff52
1 files changed, 52 insertions, 0 deletions
diff --git a/patches/8st-dynamic-cursor-color-0.8.4.diff b/patches/8st-dynamic-cursor-color-0.8.4.diff
new file mode 100644
index 0000000..a763d6d
--- /dev/null
+++ b/patches/8st-dynamic-cursor-color-0.8.4.diff
@@ -0,0 +1,52 @@
+From 01e706efbc13194a4a4404e91b93a9638a3c1bea Mon Sep 17 00:00:00 2001
+From: Kipras Melnikovas <kipras@kipras.org>
+Date: Thu, 25 Feb 2021 14:31:26 +0200
+Subject: [PATCH] refactor dynamic-cursor-color patch
+
+Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
+---
+ x.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/x.c b/x.c
+index 120e495..ab66364 100644
+--- a/x.c
++++ b/x.c
+@@ -1489,6 +1489,7 @@ void
+ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
+ {
+ Color drawcol;
++ XRenderColor colbg;
+
+ /* remove the old cursor */
+ if (selected(ox, oy))
+@@ -1518,10 +1519,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
+ g.fg = defaultfg;
+ g.bg = defaultrcs;
+ } else {
++ /** this is the main part of the dynamic cursor color patch */
++ g.bg = g.fg;
+ g.fg = defaultbg;
+- g.bg = defaultcs;
+ }
+- drawcol = dc.col[g.bg];
++
++ /**
++ * and this is the second part of the dynamic cursor color patch.
++ * it handles the `drawcol` variable
++ */
++ if (IS_TRUECOL(g.bg)) {
++ colbg.alpha = 0xffff;
++ colbg.red = TRUERED(g.bg);
++ colbg.green = TRUEGREEN(g.bg);
++ colbg.blue = TRUEBLUE(g.bg);
++ XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &drawcol);
++ } else {
++ drawcol = dc.col[g.bg];
++ }
+ }
+
+ /* draw the new one */
+--
+2.30.1
+