st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit 52900255d98a555ea952b387e835fef4ad5e1ffa
parent 78e025a0e75e0e6e3583f71019aef7136cb3c9c8
Author: bakkeby <bakkeby@gmail.com>
Date:   Tue, 11 May 2021 10:12:23 +0200

Restore cursor when exiting alt mode.

If the mouse cursor is changed to a bar or an underline then st will use that
when the terminal is first opened. When an application that changes the cursor
via escape sequences is executed, e.g. vim which uses a block cursor by default,
then that cursor will remain after exiting the program.

This change sets the cursor back to default when exiting alt mode.

Diffstat:
Mst.c | 2++
Mwin.h | 1+
Mx.c | 10++++++++++
3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/st.c b/st.c @@ -1379,6 +1379,8 @@ tswapscreen(void) term.images_alt = im; #endif // SIXEL_PATCH term.mode ^= MODE_ALTSCREEN; + if (!IS_SET(MODE_ALTSCREEN)) + xsetdefaultcursor(); tfulldirt(); } diff --git a/win.h b/win.h @@ -43,6 +43,7 @@ int xsetcolorname(int, const char *); void xseticontitle(char *); void xsettitle(char *); int xsetcursor(int); +void xsetdefaultcursor(void); void xsetmode(int, unsigned int); void xsetpointermotion(int); void xsetsel(char *); diff --git a/x.c b/x.c @@ -2415,6 +2415,16 @@ xsetcursor(int cursor) } void +xsetdefaultcursor(void) +{ + #if BLINKING_CURSOR_PATCH + xsetcursor(cursorstyle); + #else + xsetcursor(cursorshape); + #endif // BLINKING_CURSOR_PATCH +} + +void xseturgency(int add) { XWMHints *h = XGetWMHints(xw.dpy, xw.win);