macos: disable background opacity/blur in native fullscreen

See #2840
This commit is contained in:
Mitchell Hashimoto
2024-11-27 08:31:49 -08:00
parent 466d094c18
commit ba4185f6b7
2 changed files with 21 additions and 1 deletions

View File

@ -94,6 +94,16 @@ class TerminalController: BaseTerminalController {
}
}
override func fullscreenDidChange() {
super.fullscreenDidChange()
// When our fullscreen state changes, we resync our appearance because some
// properties change when fullscreen or not.
guard let focusedSurface else { return }
syncAppearance(focusedSurface.derivedConfig)
}
//MARK: - Methods
@objc private func ghosttyConfigDidChange(_ notification: Notification) {
@ -204,7 +214,13 @@ class TerminalController: BaseTerminalController {
}
// If we have window transparency then set it transparent. Otherwise set it opaque.
if (surfaceConfig.backgroundOpacity < 1) {
// Window transparency only takes effect if our window is not native fullscreen.
// In native fullscreen we disable transparency/opacity because the background
// becomes gray and widgets show through.
if (!window.styleMask.contains(.fullScreen) &&
surfaceConfig.backgroundOpacity < 1
) {
window.isOpaque = false
// This is weird, but we don't use ".clear" because this creates a look that

View File

@ -527,6 +527,10 @@ palette: Palette = .{},
/// The opacity level (opposite of transparency) of the background. A value of
/// 1 is fully opaque and a value of 0 is fully transparent. A value less than 0
/// or greater than 1 will be clamped to the nearest valid value.
///
/// On macOS, background opacity is disabled when the terminal enters native
/// fullscreen. This is because the background becomes gray and it can cause
/// widgets to show through which isn't generally desirable.
@"background-opacity": f64 = 1.0,
/// A positive value enables blurring of the background when background-opacity