From ded3dd4cbcf84e0156c3cdd4eb43ae0a2d6c2e89 Mon Sep 17 00:00:00 2001 From: himura467 Date: Fri, 10 Oct 2025 12:56:20 +0900 Subject: [PATCH] refactor(macos): do nothing if `background-opacity >= 1` --- .../Terminal/BaseTerminalController.swift | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index 892bef555..f8e0cc8e9 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -818,17 +818,14 @@ class BaseTerminalController: NSWindowController, // MARK: Background Opacity /// Toggle the background opacity between transparent and opaque states. - /// If the configured background-opacity is already opaque (>= 1), this resets - /// the override flag to false so that future config changes take effect. - /// Subclasses should override this to sync their appearance after toggling. + /// Do nothing if the configured background-opacity is >= 1 (already opaque). + /// Subclasses should override this to add platform-specific checks and sync appearance. func toggleBackgroundOpacity() { - // If config is already opaque, just ensure override is disabled - if ghostty.config.backgroundOpacity >= 1 { - isBackgroundOpaque = false - } else { - // Otherwise toggle between transparent and opaque - isBackgroundOpaque.toggle() - } + // Do nothing if config is already fully opaque + guard ghostty.config.backgroundOpacity < 1 else { return } + + // Toggle between transparent and opaque + isBackgroundOpaque.toggle() } // MARK: Fullscreen