Skip to content

Commit

Permalink
config: title can reload at runtime (#2906)
Browse files Browse the repository at this point in the history
Related to #2898
  • Loading branch information
mitchellh authored Dec 8, 2024
2 parents ddf59e7 + 43a7dec commit 40ad31d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
6 changes: 6 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 40ad31d

Please sign in to comment.