From 84d48d1c6a9d4fb93eccd31cf0a731adbe174d02 Mon Sep 17 00:00:00 2001 From: Michal Olechowski Date: Fri, 6 Mar 2026 21:09:04 +0100 Subject: [PATCH] config: add progress-style option Add option to disable OSC 9;4 ConEmu progress bars via config. Fixes #11241 --- macos/Sources/Ghostty/Ghostty.App.swift | 9 +++++++++ macos/Sources/Ghostty/Ghostty.Config.swift | 8 ++++++++ src/apprt/gtk/class/surface.zig | 8 ++++++++ src/config/Config.zig | 5 +++++ 4 files changed, 30 insertions(+) diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index 82b3ad35c..38cc27800 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -1934,6 +1934,15 @@ extension Ghostty { case GHOSTTY_TARGET_SURFACE: guard let surface = target.target.surface else { return } guard let surfaceView = self.surfaceView(from: surface) else { return } + guard let config = (NSApplication.shared.delegate as? AppDelegate)?.ghostty.config else { return } + + guard config.progressStyle else { + Ghostty.logger.debug("progress_report action blocked by config") + DispatchQueue.main.async { + surfaceView.progressReport = nil + } + return + } let progressReport = Ghostty.Action.ProgressReport(c: v) DispatchQueue.main.async { diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index 87ae0511f..775e4c946 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -717,6 +717,14 @@ extension Ghostty { let buffer = UnsafeBufferPointer(start: v.commands, count: v.len) return buffer.map { Ghostty.Command(cValue: $0) } } + + var progressStyle: Bool { + guard let config = self.config else { return true } + var v = true + let key = "progress-style" + _ = ghostty_config_get(config, &v, key, UInt(key.lengthOfBytes(using: .utf8))) + return v + } } } diff --git a/src/apprt/gtk/class/surface.zig b/src/apprt/gtk/class/surface.zig index 8d9e1bcf0..5b4a7e183 100644 --- a/src/apprt/gtk/class/surface.zig +++ b/src/apprt/gtk/class/surface.zig @@ -1012,6 +1012,14 @@ pub const Surface = extern struct { priv.progress_bar_timer = null; } + if (priv.config) |config| { + if (!config.get().@"progress-style") { + log.debug("progress_report action blocked by config", .{}); + priv.progress_bar_overlay.as(gtk.Widget).setVisible(@intFromBool(false)); + return; + } + } + const progress_bar = priv.progress_bar_overlay; switch (value.state) { // Remove the progress bar diff --git a/src/config/Config.zig b/src/config/Config.zig index ca93c85d6..26b5141f8 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -3636,6 +3636,11 @@ else /// notifications using certain escape sequences such as OSC 9 or OSC 777. @"desktop-notifications": bool = true, +/// If `true` (default), applications running in the terminal can show +/// graphical progress bars using the ConEmu OSC 9;4 escape sequence. +/// If `false`, progress bar sequences are silently ignored. +@"progress-style": bool = true, + /// Modifies the color used for bold text in the terminal. /// /// This can be set to a specific color, using the same format as