diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index c12d78ed1..36e48af4e 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -1729,6 +1729,7 @@ DecorationTypes = Literal[ def render_decoration( which: DecorationTypes, cell_width: int, cell_height: int, underline_position: int, underline_thickness: int, dpi: float = 96.0 ) -> bytes: ... +def os_window_is_invisible(os_window_id: int) -> bool: ... class MousePosition(TypedDict): cell_x: int diff --git a/kitty/state.c b/kitty/state.c index 40a2a0f67..7570d611e 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -939,6 +939,7 @@ PYWRAP1(set_os_window_chrome) { PYWRAP1(mark_tab_bar_dirty) { id_type os_window_id = PyLong_AsUnsignedLongLong(args); + if (PyErr_Occurred()) return NULL; WITH_OS_WINDOW(os_window_id) os_window->tab_bar_data_updated = false; END_WITH_OS_WINDOW @@ -959,6 +960,7 @@ PYWRAP1(change_background_opacity) { PYWRAP1(background_opacity_of) { id_type os_window_id = PyLong_AsUnsignedLongLong(args); + if (PyErr_Occurred()) return NULL; WITH_OS_WINDOW(os_window_id) return PyFloat_FromDouble((double)os_window->background_opacity); END_WITH_OS_WINDOW @@ -1048,7 +1050,15 @@ PYWRAP1(get_os_window_title) { Py_RETURN_NONE; } - +PYWRAP1(os_window_is_invisible) { + id_type os_window_id = PyLong_AsUnsignedLongLong(args); + if (PyErr_Occurred()) return NULL; + WITH_OS_WINDOW(os_window_id) + if (should_os_window_be_rendered(os_window)) { Py_RETURN_FALSE; } + Py_RETURN_TRUE; + END_WITH_OS_WINDOW + Py_RETURN_FALSE; +} PYWRAP1(pt_to_px) { double pt; @@ -1490,6 +1500,7 @@ static PyMethodDef module_methods[] = { MW(os_window_font_size, METH_VARARGS), MW(set_os_window_size, METH_VARARGS), MW(get_os_window_size, METH_VARARGS), + MW(os_window_is_invisible, METH_O), MW(update_tab_bar_edge_colors, METH_VARARGS), MW(set_boss, METH_O), MW(get_boss, METH_NOARGS),