From 0e0aba7a5e81a406c66941445b544d7e18c40c46 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sun, 14 Apr 2019 18:07:26 +0200 Subject: [PATCH 1/4] Option for hide mouse on keypress event --- kitty/config_data.py | 2 ++ kitty/keys.c | 1 + kitty/state.c | 1 + kitty/state.h | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index e9cfea8bf..78800d994 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -449,6 +449,8 @@ o('mouse_hide_wait', 3.0, option_type=positive_float, long_text=_(''' Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to zero to disable mouse cursor hiding.''')) +o('mouse_hide_key', True, long_text=_('''TODO''')) + o('focus_follows_mouse', False, long_text=_(''' Set the active window to the window under the mouse when moving the mouse around''')) diff --git a/kitty/keys.c b/kitty/keys.c index 58e0e8781..60017ed5e 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -180,6 +180,7 @@ on_key_input(int key, int scancode, int action, int mods, const char* text, int bool ok_to_send = action == GLFW_PRESS || action == GLFW_REPEAT || screen->modes.mEXTENDED_KEYBOARD; if (ok_to_send) { if (has_text) { + if (OPT(mouse_hide_key)) hide_mouse(global_state.callback_os_window); schedule_write_to_child(w->id, 1, text, strlen(text)); debug("sent text to child\n"); } else { diff --git a/kitty/state.c b/kitty/state.c index 7375e0088..786b0b2da 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -382,6 +382,7 @@ PYWRAP1(set_options) { S(url_style, PyLong_AsUnsignedLong); S(tab_bar_edge, PyLong_AsLong); S(mouse_hide_wait, PyFloat_AsDouble); + S(mouse_hide_key, PyObject_IsTrue); S(wheel_scroll_multiplier, PyFloat_AsDouble); S(touch_scroll_multiplier, PyFloat_AsDouble); S(open_url_modifiers, convert_mods); diff --git a/kitty/state.h b/kitty/state.h index 182a6ff63..bb3f74395 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -14,7 +14,7 @@ typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge; typedef struct { double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier, touch_scroll_multiplier; - bool enable_audio_bell; + bool mouse_hide_key, enable_audio_bell; CursorShape cursor_shape; unsigned int open_url_modifiers; unsigned int rectangle_select_modifiers; From beb90f2c550676db9c4b7170ba5fd9617540ece0 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Mon, 15 Apr 2019 09:17:31 +0200 Subject: [PATCH 2/4] Implement feedback --- kitty/config_data.py | 6 ++---- kitty/keys.c | 2 +- kitty/state.c | 1 - kitty/state.h | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index 78800d994..ba99087e4 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -445,11 +445,9 @@ o('click_interval', -1.0, option_type=float, long_text=_(''' The interval between successive clicks to detect double/triple clicks (in seconds). Negative numbers will use the system default instead, if available, or fallback to 0.5.''')) -o('mouse_hide_wait', 3.0, option_type=positive_float, long_text=_(''' +o('mouse_hide_wait', 3.0, option_type=float, long_text=_(''' Hide mouse cursor after the specified number of seconds -of the mouse not being used. Set to zero to disable mouse cursor hiding.''')) - -o('mouse_hide_key', True, long_text=_('''TODO''')) +of the mouse not being used. Set to zero to disable mouse cursor hiding. TODO''')) o('focus_follows_mouse', False, long_text=_(''' Set the active window to the window under the mouse when diff --git a/kitty/keys.c b/kitty/keys.c index 60017ed5e..ab80ebd66 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -180,7 +180,7 @@ on_key_input(int key, int scancode, int action, int mods, const char* text, int bool ok_to_send = action == GLFW_PRESS || action == GLFW_REPEAT || screen->modes.mEXTENDED_KEYBOARD; if (ok_to_send) { if (has_text) { - if (OPT(mouse_hide_key)) hide_mouse(global_state.callback_os_window); + if (OPT(mouse_hide_wait) < 0) hide_mouse(global_state.callback_os_window); schedule_write_to_child(w->id, 1, text, strlen(text)); debug("sent text to child\n"); } else { diff --git a/kitty/state.c b/kitty/state.c index 786b0b2da..7375e0088 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -382,7 +382,6 @@ PYWRAP1(set_options) { S(url_style, PyLong_AsUnsignedLong); S(tab_bar_edge, PyLong_AsLong); S(mouse_hide_wait, PyFloat_AsDouble); - S(mouse_hide_key, PyObject_IsTrue); S(wheel_scroll_multiplier, PyFloat_AsDouble); S(touch_scroll_multiplier, PyFloat_AsDouble); S(open_url_modifiers, convert_mods); diff --git a/kitty/state.h b/kitty/state.h index bb3f74395..182a6ff63 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -14,7 +14,7 @@ typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge; typedef struct { double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier, touch_scroll_multiplier; - bool mouse_hide_key, enable_audio_bell; + bool enable_audio_bell; CursorShape cursor_shape; unsigned int open_url_modifiers; unsigned int rectangle_select_modifiers; From a309069b6b1b3bdf13069465ab4ff99c232971b4 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Mon, 15 Apr 2019 09:51:57 +0200 Subject: [PATCH 3/4] Describe new feature in config_data.py --- kitty/config_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index ba99087e4..c13355335 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -447,7 +447,8 @@ Negative numbers will use the system default instead, if available, or fallback o('mouse_hide_wait', 3.0, option_type=float, long_text=_(''' Hide mouse cursor after the specified number of seconds -of the mouse not being used. Set to zero to disable mouse cursor hiding. TODO''')) +of the mouse not being used. Set to zero to disable mouse cursor hiding. +Set to a negative value to hide the mouse cursor immediately when typing text.''')) o('focus_follows_mouse', False, long_text=_(''' Set the active window to the window under the mouse when From df9c1aea64b56eb743a1e6bbbb4e5e5db2f02ce3 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Mon, 15 Apr 2019 10:11:54 +0200 Subject: [PATCH 4/4] Add note to changelog.rst --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index cce4440c0..ca97b11fe 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -108,6 +108,9 @@ To update |kitty|, :doc:`follow the instructions `. - Allow setting :opt:`active_border_color` to ``none`` to not draw a border around the active window (:iss:`805`) +- Use negative values for :opt:`mouse_hide_wait` to hide the mouse cursor + immediately when pressing a key (:iss:`1534`) + 0.13.3 [2019-01-19] ------------------------------