From ed1a15767b0882a70c91d0432a84a920c8546093 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 22:18:47 +0000 Subject: [PATCH 44/71] feat(macos): show the render backend (GL) in the window title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it obvious which backend a window is actually using: GL sessions get a trailing " — GL" on the titlebar; CPU sessions (the default) get no suffix, keeping the common case clean. All title updates (working-directory default and shell OSC-0/2 titles) funnel through one setWindowTitle: method so the tag is applied consistently. Reads the session's actual backend (bridge_render_mode), so a GL request that fell back to CPU shows no tag — the title reflects reality, not the request. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/TerminalView.mm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/contour_macos/TerminalView.mm b/src/contour_macos/TerminalView.mm index a7d65689..0cd09323 100644 --- a/src/contour_macos/TerminalView.mm +++ b/src/contour_macos/TerminalView.mm @@ -122,6 +122,7 @@ void cbOnClosed(void* userData) - (void)drawFrameGL; - (NSString*)titleFromWorkingDirectory:(NSString*)cwd; - (void)updateTitleFromWorkingDirectory; +- (void)setWindowTitle:(NSString*)title; @end @implementation TerminalView @@ -278,6 +279,18 @@ void cbOnClosed(void* userData) [self setNeedsDisplay:YES]; } +// Sets the window title, appending the render-backend indicator. GL sessions get a trailing +// " — GL" so it is obvious which backend a window is actually using; CPU sessions (the default) +// get no suffix to keep the common case clean. All title paths funnel through here so the tag is +// consistent whether the title came from the working directory or a shell OSC sequence. +- (void)setWindowTitle:(NSString*)title +{ + NSString* shown = title; + if (_renderMode == contour_macos::BridgeRender_OpenGL) + shown = [title stringByAppendingString:@" — GL"]; + [[self window] setTitle:shown]; +} + - (void)mainThreadSetTitle:(NSString*)title { // An empty OSC title (e.g. the shell clearing it) should not blank the titlebar — fall back to @@ -287,7 +300,7 @@ void cbOnClosed(void* userData) [self updateTitleFromWorkingDirectory]; return; } - [[self window] setTitle:title]; + [self setWindowTitle:title]; } - (void)mainThreadBell @@ -343,7 +356,7 @@ void cbOnClosed(void* userData) if (cwd) free(cwd); NSString* title = [self titleFromWorkingDirectory:cwdStr]; - [[self window] setTitle:(title ? title : @"contour")]; + [self setWindowTitle:(title ? title : @"contour")]; } - (void)viewDidMoveToWindow