diff options
| author | Craig Jennings <craigmartinjennings@gmail.com> | 2023-07-23 17:52:54 -0500 |
|---|---|---|
| committer | Craig Jennings <craigmartinjennings@gmail.com> | 2023-07-23 17:52:54 -0500 |
| commit | d8316e91af2f9218cf382196adcb9c06aa382381 (patch) | |
| tree | 21122db601360ecabaa99d25cdec5921a17c78ad | |
| parent | 022efec2510304ca41c5224085970df3f5e53dba (diff) | |
added dynamic cursor color patch
| -rw-r--r-- | patches_applied/st-dynamic-cursor-color-0.9.diff | 50 | ||||
| -rw-r--r-- | todo.org | 29 | ||||
| -rw-r--r-- | x.c | 17 |
3 files changed, 80 insertions, 16 deletions
diff --git a/patches_applied/st-dynamic-cursor-color-0.9.diff b/patches_applied/st-dynamic-cursor-color-0.9.diff new file mode 100644 index 0000000..1034595 --- /dev/null +++ b/patches_applied/st-dynamic-cursor-color-0.9.diff @@ -0,0 +1,50 @@ +From 215ec30d6b5fe3319f88f1c9d16a37b6e14e5a53 Mon Sep 17 00:00:00 2001 +From: Bakkeby <bakkeby@gmail.com> +Date: Mon, 19 Dec 2022 10:20:47 +0100 +Subject: [PATCH] dynamic cursor color: cursor color taken from current + character + +--- + x.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/x.c b/x.c +index 2a3bd38..21aadce 100644 +--- a/x.c ++++ b/x.c +@@ -1520,6 +1520,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)) +@@ -1548,11 +1549,21 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) + if (selected(cx, cy)) { + g.fg = defaultfg; + g.bg = defaultrcs; ++ } else if (!(og.mode & ATTR_REVERSE)) { ++ unsigned long col = g.bg; ++ g.bg = g.fg; ++ g.fg = col; ++ } ++ ++ 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 { +- g.fg = defaultbg; +- g.bg = defaultcs; ++ drawcol = dc.col[g.bg]; + } +- drawcol = dc.col[g.bg]; + } + + /* draw the new one */ +-- +2.38.1 + @@ -1,18 +1,5 @@ ST Patches * ST Patches Open Work -** TODO [#B] dynamic cursor color -*** Description and URLs -Swaps the colors of your cursor and the character you're currently on (much like alacritty). Some say the effect is very appealing:) -Notes - -Might be incomplete - I'm new and improvements are very welcome! - - Might have some edge cases where it doesn't work properly - Performance degradation considerations? More testing & feedback needed - -https://st.suckless.org/patches/dynamic-cursor-color/ -https://st.suckless.org/patches/dynamic-cursor-color/st-dynamic-cursor-color-0.9.diff - ** TODO [#C] .desktop entry st-desktopentry-0.8.5.diff ** TODO [#C] netwmicon @@ -125,6 +112,22 @@ https://st.suckless.org/patches/externalpipe/st-externalpipe-0.8.4.diff When using the scrollback patch, you can apply this patch ontop in order to use externalpipe onto the entire terminal history: https://st.suckless.org/patches/externalpipe/st-externalpipe-eternal-0.8.3.diff * ST Patches Completed +** DONE [#B] dynamic cursor color +*** 2023-07-23 @ 17:47:28 -0500 simple test succeeded +Changed foreground color in ~/.Xresources to red, typed changes, then backed over them. It worked fine. +*** 2023-07-23 @ 17:45:31 -0500 patch applied successfully without issue +*** Description and URLs +Swaps the colors of your cursor and the character you're currently on (much like alacritty). Some say the effect is very appealing:) +Notes + +Might be incomplete - I'm new and improvements are very welcome! + + Might have some edge cases where it doesn't work properly + Performance degradation considerations? More testing & feedback needed + +https://st.suckless.org/patches/dynamic-cursor-color/ +https://st.suckless.org/patches/dynamic-cursor-color/st-dynamic-cursor-color-0.9.diff + ** DONE [#B] xresources with signal reloading *** 2023-07-23 @ 17:33:40 -0500 Verification Steps Succeeded Added configuration options to .Xresources and launched ST to verify them @@ -1694,6 +1694,7 @@ void xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len) { Color drawcol; + XRenderColor colbg; /* remove the old cursor */ if (selected(ox, oy)) @@ -1725,11 +1726,21 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le if (selected(cx, cy)) { g.fg = defaultfg; g.bg = defaultrcs; + } else if (!(og.mode & ATTR_REVERSE)) { + unsigned long col = g.bg; + g.bg = g.fg; + g.fg = col; + } + + 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 { - g.fg = defaultbg; - g.bg = defaultcs; + drawcol = dc.col[g.bg]; } - drawcol = dc.col[g.bg]; } /* draw the new one */ |
