refactor(macos): do nothing if `background-opacity >= 1`

pull/9117/head
himura467 2025-10-10 12:56:20 +09:00 committed by Mitchell Hashimoto
parent 4c6d3f8ed2
commit ded3dd4cbc
1 changed files with 7 additions and 10 deletions

View File

@ -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