diff --git a/kitty/config_data.py b/kitty/config_data.py index db95e7585..26f4d1f24 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -520,6 +520,9 @@ def url_prefixes(x: str) -> Tuple[str, ...]: o('url_prefixes', 'http https file ftp', option_type=url_prefixes, long_text=_(''' The set of URL prefixes to look for when detecting a URL under the mouse cursor.''')) +o('detect_urls', True, long_text=_(''' +Detect URL under the mouse cursor. If disabled URLs are still clickable.''')) + def copy_on_select(raw: str) -> str: q = raw.lower() diff --git a/kitty/mouse.c b/kitty/mouse.c index e5a69c073..6794b1c6a 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -368,7 +368,9 @@ HANDLER(handle_move_event) { bool in_left_half_of_cell = false; if (!cell_for_pos(w, &x, &y, &in_left_half_of_cell, global_state.callback_os_window)) return; Screen *screen = w->render_data.screen; - detect_url(screen, x, y); + if(OPT(detect_urls)) { + detect_url(screen, x, y); + } bool mouse_cell_changed = x != w->mouse_pos.cell_x || y != w->mouse_pos.cell_y; bool cell_half_changed = in_left_half_of_cell != w->mouse_pos.in_left_half_of_cell; w->mouse_pos.cell_x = x; w->mouse_pos.cell_y = y; diff --git a/kitty/state.c b/kitty/state.c index 697e58913..711064ad5 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -705,6 +705,7 @@ PYWRAP1(set_options) { S(pointer_shape_when_grabbed, pointer_shape); S(default_pointer_shape, pointer_shape); S(pointer_shape_when_dragging, pointer_shape); + S(detect_urls, PyObject_IsTrue); GA(tab_bar_style); global_state.tab_bar_hidden = PyUnicode_CompareWithASCIIString(ret, "hidden") == 0 ? true: false; diff --git a/kitty/state.h b/kitty/state.h index 2e2b78675..a260f160f 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -72,6 +72,7 @@ typedef struct { UrlPrefix *values; size_t num, max_prefix_len; } url_prefixes; + bool detect_urls; } Options; typedef struct {