Skip to content

Prevent mouse cursor from showing on short, unintentional flicks - #8508

Merged
kovidgoyal merged 2 commits into
kovidgoyal:masterfrom
irisjae:upstream
Apr 4, 2025
Merged

Prevent mouse cursor from showing on short, unintentional flicks#8508
kovidgoyal merged 2 commits into
kovidgoyal:masterfrom
irisjae:upstream

Conversation

@irisjae

@irisjae irisjae commented Apr 4, 2025

Copy link
Copy Markdown

I use kitty daily, and hiding the mouse in my terminal helps my focus a lot. Currently, kitty always shows the mouse cursor immediately after I move the mouse, even if it happens due to unintentional flicks on my trackpad, breaking my focus.

In this patch, I've added three new options mouse_show_wait, mouse_show_threshold, and mouse_scroll_show. mouse_show_wait controls how long to wait before mouse activity is treated an intentional, mouse_show_threshold controls the threshold to treat mouse activity as intentional, and mouse_scroll_show controls whether mouse scrolls trigger unhiding the mouse cursor. The current behaviour can be recovered by setting mouse_show_wait to 0, and is configured to be the default.

@kovidgoyal

Copy link
Copy Markdown
Owner

Rather than making these new options, make mouse_hide_wait take optional extra fields. You can do that by changing option_type to a custom function defined in options/utils.py and similarly adding a function to to-c.h and setting ctype to !c_function_name.

Also in Options use an anonymous struct to group these settings together.

@irisjae

irisjae commented Apr 4, 2025

Copy link
Copy Markdown
Author

Thanks for your quick response! I've made the changes you mentioned, see if that's right?

…optional parameters for struct. mouse_show_* renamed to mouse_unhide_*
@kovidgoyal

Copy link
Copy Markdown
Owner

Looks generally OK after a quick once over will review in detail when I have some time.

@kovidgoyal
kovidgoyal merged commit 738d692 into kovidgoyal:master Apr 4, 2025
@irisjae

irisjae commented Apr 5, 2025

Copy link
Copy Markdown
Author

Hi, I see that in your cleanup commit 3d440cf you replaced the / 1e9 calculation with monotonic_t_to_ms, I think that should be monotonic_t_to_s_double? If we make unhide event threshold to be <ms> * <threshold-option>, that's 3 orders of magnitude bigger than what I intended in the option documentation, and the threshold option is too coarse to allow unhiding with reasonable mouse activity.

@kovidgoyal

Copy link
Copy Markdown
Owner

yup, sorry, typo. fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants