mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-22 20:17:45 +03:00
Fix kitty --title not overriding tab titles
It must set the OS Window title permanently. Fixes #3893
This commit is contained in:
parent
be34af4555
commit
70b5f5bce3
@ -10,6 +10,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- A new style for the tab bar that makes tabs looks like the tabs in a physical
|
- A new style for the tab bar that makes tabs looks like the tabs in a physical
|
||||||
tabbed file, see :opt:`tab_bar_style`
|
tabbed file, see :opt:`tab_bar_style`
|
||||||
|
|
||||||
|
- Fix :option:`kitty --title` not overriding the OS Window title when multiple
|
||||||
|
tabs are present (:iss:`3893`)
|
||||||
|
|
||||||
|
|
||||||
0.22.2 [2021-08-02]
|
0.22.2 [2021-08-02]
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ def add_os_window(
|
|||||||
os_window_id = create_os_window(
|
os_window_id = create_os_window(
|
||||||
initial_window_size_func(size_data, self.cached_values),
|
initial_window_size_func(size_data, self.cached_values),
|
||||||
pre_show_callback,
|
pre_show_callback,
|
||||||
self.args.title or appname, wname, wclass)
|
self.args.title or appname, wname, wclass, disallow_override_title=bool(self.args.title))
|
||||||
else:
|
else:
|
||||||
wname = self.args.name or self.args.cls or appname
|
wname = self.args.name or self.args.cls or appname
|
||||||
wclass = self.args.cls or appname
|
wclass = self.args.cls or appname
|
||||||
|
@ -596,7 +596,7 @@ def options_spec() -> str:
|
|||||||
|
|
||||||
|
|
||||||
--title -T
|
--title -T
|
||||||
Set the window title. This will override any title set by the program running inside kitty. So
|
Set the OS window title. This will override any title set by the program running inside kitty. So
|
||||||
only use this if you are running a program that does not set titles. If combined
|
only use this if you are running a program that does not set titles. If combined
|
||||||
with :option:`{appname} --session` the title will be used for all windows created by the
|
with :option:`{appname} --session` the title will be used for all windows created by the
|
||||||
session, that do not set their own titles.
|
session, that do not set their own titles.
|
||||||
|
@ -494,7 +494,8 @@ def create_os_window(
|
|||||||
wm_class_class: str,
|
wm_class_class: str,
|
||||||
load_programs: Optional[Callable[[bool], None]] = None,
|
load_programs: Optional[Callable[[bool], None]] = None,
|
||||||
x: int = -1,
|
x: int = -1,
|
||||||
y: int = -1
|
y: int = -1,
|
||||||
|
disallow_override_title: bool = False,
|
||||||
) -> int:
|
) -> int:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -623,12 +623,12 @@ native_window_handle(GLFWwindow *w) {
|
|||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
||||||
int x = -1, y = -1;
|
int x = -1, y = -1, disallow_override_title = 0;
|
||||||
char *title, *wm_class_class, *wm_class_name;
|
char *title, *wm_class_class, *wm_class_name;
|
||||||
PyObject *load_programs = NULL, *get_window_size, *pre_show_callback;
|
PyObject *load_programs = NULL, *get_window_size, *pre_show_callback;
|
||||||
static const char* kwlist[] = {"get_window_size", "pre_show_callback", "title", "wm_class_name", "wm_class_class", "load_programs", "x", "y", NULL};
|
static const char* kwlist[] = {"get_window_size", "pre_show_callback", "title", "wm_class_name", "wm_class_class", "load_programs", "x", "y", "disallow_override_title", NULL};
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "OOsss|Oii", (char**)kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OOsss|Oiip", (char**)kwlist,
|
||||||
&get_window_size, &pre_show_callback, &title, &wm_class_name, &wm_class_class, &load_programs, &x, &y)) return NULL;
|
&get_window_size, &pre_show_callback, &title, &wm_class_name, &wm_class_class, &load_programs, &x, &y, &disallow_override_title)) return NULL;
|
||||||
|
|
||||||
static bool is_first_window = true;
|
static bool is_first_window = true;
|
||||||
if (is_first_window) {
|
if (is_first_window) {
|
||||||
@ -742,6 +742,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
|||||||
}
|
}
|
||||||
OSWindow *w = add_os_window();
|
OSWindow *w = add_os_window();
|
||||||
w->handle = glfw_window;
|
w->handle = glfw_window;
|
||||||
|
w->disallow_title_changes = disallow_override_title;
|
||||||
update_os_window_references();
|
update_os_window_references();
|
||||||
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
||||||
// On some platforms (macOS) newly created windows don't get the initial focus in event
|
// On some platforms (macOS) newly created windows don't get the initial focus in event
|
||||||
|
@ -157,7 +157,7 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ())
|
|||||||
run_app.initial_window_size_func(get_os_window_sizing_data(opts), cached_values),
|
run_app.initial_window_size_func(get_os_window_sizing_data(opts), cached_values),
|
||||||
pre_show_callback,
|
pre_show_callback,
|
||||||
args.title or appname, args.name or args.cls or appname,
|
args.title or appname, args.name or args.cls or appname,
|
||||||
args.cls or appname, load_all_shaders)
|
args.cls or appname, load_all_shaders, disallow_override_title=bool(args.title))
|
||||||
boss = Boss(opts, args, cached_values, global_shortcuts)
|
boss = Boss(opts, args, cached_values, global_shortcuts)
|
||||||
boss.start(window_id)
|
boss.start(window_id)
|
||||||
if bad_lines:
|
if bad_lines:
|
||||||
|
@ -264,6 +264,7 @@ update_window_title(id_type os_window_id, id_type tab_id, id_type window_id, PyO
|
|||||||
|
|
||||||
void
|
void
|
||||||
set_os_window_title_from_window(Window *w, OSWindow *os_window) {
|
set_os_window_title_from_window(Window *w, OSWindow *os_window) {
|
||||||
|
if (os_window->disallow_title_changes) return;
|
||||||
if (w->title && w->title != os_window->window_title) {
|
if (w->title && w->title != os_window->window_title) {
|
||||||
Py_XDECREF(os_window->window_title);
|
Py_XDECREF(os_window->window_title);
|
||||||
os_window->window_title = w->title;
|
os_window->window_title = w->title;
|
||||||
|
@ -176,6 +176,7 @@ typedef struct {
|
|||||||
double logical_dpi_x, logical_dpi_y, font_sz_in_pts;
|
double logical_dpi_x, logical_dpi_y, font_sz_in_pts;
|
||||||
bool mouse_button_pressed[32];
|
bool mouse_button_pressed[32];
|
||||||
PyObject *window_title;
|
PyObject *window_title;
|
||||||
|
bool disallow_title_changes;
|
||||||
bool viewport_size_dirty, viewport_updated_at_least_once;
|
bool viewport_size_dirty, viewport_updated_at_least_once;
|
||||||
LiveResizeInfo live_resize;
|
LiveResizeInfo live_resize;
|
||||||
bool has_pending_resizes, is_semi_transparent, shown_once, is_damaged;
|
bool has_pending_resizes, is_semi_transparent, shown_once, is_damaged;
|
||||||
|
Loading…
Reference in New Issue
Block a user