From b0660ecf476a1a5c3e576c91f9cf522637608cb9 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Wed, 9 Jun 2021 09:54:50 +0200 Subject: [PATCH] Adding hide terminal cursor patch --- README.md | 5 +++++ patches.def.h | 6 ++++++ x.c | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 9ca6962..6a7c979 100644 --- 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 index 88f5ee1..34ab167 100644 --- 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 index 3eed6fb..2767045 100644 --- 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.