commit b0660ecf476a1a5c3e576c91f9cf522637608cb9
parent ba7f4f98e27d30c5a606ef30f529fcb661f131fe
Author: bakkeby <bakkeby@gmail.com>
Date: Wed, 9 Jun 2021 09:54:50 +0200
Adding hide terminal cursor patch
Diffstat:
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
+2021-06-09 - Added the hide terminal cursor patch
+
2021-05-16 - Added swapmouse patch
2021-05-11 - Added default cursor patch
@@ -147,6 +149,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [hidecursor](https://st.suckless.org/patches/hidecursor/)
- hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window
+ - [hide-terminal-cursor](https://www.reddit.com/r/suckless/comments/nvee8h/how_to_hide_cursor_in_st_is_there_a_patch_for_it/)
+ - hides the terminal cursor when the window loses focus (as opposed to showing a hollow cursor)
+
- [invert](https://st.suckless.org/patches/invert/)
- adds a keybinding that lets you invert the current colorscheme of st
- this provides a simple way to temporarily switch to a light colorscheme if you use a dark colorscheme or visa-versa
diff --git a/patches.def.h b/patches.def.h
@@ -163,6 +163,12 @@
*/
#define HIDECURSOR_PATCH 0
+/* This patch hides the terminal cursor when the window loses focus (as opposed to showing a hollow
+ * cursor).
+ * https://www.reddit.com/r/suckless/comments/nvee8h/how_to_hide_cursor_in_st_is_there_a_patch_for_it/
+ */
+#define HIDE_TERMINAL_CURSOR_PATCH 0
+
/* This patch adds a keybinding that lets you invert the current colorscheme of st.
* This provides a simple way to temporarily switch to a light colorscheme if you use a dark
* colorscheme or visa-versa.
diff --git a/x.c b/x.c
@@ -1995,8 +1995,13 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
xdrawglyph(og, ox, oy);
#endif // LIGATURES_PATCH
+ #if HIDE_TERMINAL_CURSOR_PATCH
+ if (IS_SET(MODE_HIDE) || !IS_SET(MODE_FOCUSED))
+ return;
+ #else
if (IS_SET(MODE_HIDE))
return;
+ #endif // HIDE_TERMINAL_CURSOR_PATCH
/*
* Select the right color for the right mode.