mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Set gtk window title on change and tab swap (by key command)
This commit is contained in:
@ -531,6 +531,11 @@ const Window = struct {
|
||||
const page_idx = c.gtk_notebook_get_current_page(self.notebook);
|
||||
const widget = c.gtk_notebook_get_nth_page(self.notebook, page_idx);
|
||||
_ = c.gtk_widget_grab_focus(widget);
|
||||
|
||||
const gtk_label_box = @as(*c.GtkWidget, @ptrCast(c.gtk_notebook_get_tab_label(self.notebook, widget)));
|
||||
const gtk_label = @as(*c.GtkLabel, @ptrCast(c.gtk_widget_get_first_child(gtk_label_box)));
|
||||
const label_text = c.gtk_label_get_text(gtk_label);
|
||||
c.gtk_window_set_title(self.window, label_text);
|
||||
}
|
||||
|
||||
fn gtkTabAddClick(_: *c.GtkButton, ud: ?*anyopaque) callconv(.C) void {
|
||||
@ -939,6 +944,11 @@ pub const Surface = struct {
|
||||
|
||||
.label => |label| {
|
||||
c.gtk_label_set_text(label, slice.ptr);
|
||||
|
||||
const widget = @as(*c.GtkWidget, @ptrCast(self.gl_area));
|
||||
if (c.gtk_widget_is_focus(widget) == 1) {
|
||||
c.gtk_window_set_title(self.window.window, c.gtk_label_get_text(label));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user