From 43a7dece02953d90e76f057a730f4e614c4cd87e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 8 Dec 2024 11:22:02 -0800 Subject: [PATCH] config: title can reload at runtime Related to #2898 --- src/Surface.zig | 8 ++++++++ src/config/Config.zig | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index 78a8426738..3e7300d08f 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1182,6 +1182,14 @@ pub fn updateConfig( log.warn("failed to notify renderer of config change err={}", .{err}); }; + // If we have a title set then we update our window to have the + // newly configured title. + if (config.title) |title| try self.rt_app.performAction( + .{ .surface = self }, + .set_title, + .{ .title = title }, + ); + // Notify the window try self.rt_app.performAction( .{ .surface = self }, diff --git a/src/config/Config.zig b/src/config/Config.zig index 7fda17289b..1bb8f48c45 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -679,6 +679,12 @@ fullscreen: bool = false, /// The title Ghostty will use for the window. This will force the title of the /// window to be this title at all times and Ghostty will ignore any set title /// escape sequences programs (such as Neovim) may send. +/// +/// This configuration can be reloaded at runtime. If it is set, the title +/// will update for all windows. If it is unset, the next title change escape +/// sequence will be honored but previous changes will not retroactively +/// be set. This latter case may require you restart programs such as neovim +/// to get the new title. title: ?[:0]const u8 = null, /// The setting that will change the application class value.