repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
060c4f5
parent
d9e8cab
author
Eric Bower
date
2025-12-03 22:02:51 -0500 EST
fix: ghostty should not send color pallet on re-attach

When `zmx` starts a session, `ghostty-vt.Terminal.init()` uses Ghostty's default palette, not foot's palette. On reattach, it dumps all 256 colors from ghostty's defaults, which may differ from foot's defaults.

References: https://github.com/neurosnap/zmx/issues/7
1 files changed,  +9, -1
M src/main.zig
+9, -1
 1@@ -718,7 +718,15 @@ fn daemonLoop(daemon: *Daemon, server_sock_fd: i32, pty_fd: i32) !void {
 2                                     defer builder.deinit();
 3                                     var term_formatter = ghostty_vt.formatter.TerminalFormatter.init(&term, .vt);
 4                                     term_formatter.content = .{ .selection = null };
 5-                                    term_formatter.extra = .all;
 6+                                    term_formatter.extra = .{
 7+                                        .palette = false, // Don't override host terminal's palette
 8+                                        .modes = true,
 9+                                        .scrolling_region = true,
10+                                        .tabstops = true,
11+                                        .pwd = true,
12+                                        .keyboard = true,
13+                                        .screen = .all,
14+                                    };
15                                     term_formatter.format(&builder.writer) catch |err| {
16                                         std.log.warn("failed to format terminal state err={s}", .{@errorName(err)});
17                                     };