mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
macos: quick terminal uses padded notch mode if notch is visible (#7098)
Fixes #6612
This commit is contained in:
@ -495,14 +495,20 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
private func onToggleFullscreen() {
|
private func onToggleFullscreen() {
|
||||||
// We ignore the configured fullscreen style and always use non-native
|
// We ignore the configured fullscreen style and always use non-native
|
||||||
// because the way the quick terminal works doesn't support native.
|
// because the way the quick terminal works doesn't support native.
|
||||||
//
|
let mode: FullscreenMode
|
||||||
// An additional detail is that if the is NOT frontmost, then our
|
if (NSApp.isFrontmost) {
|
||||||
// NSApp.presentationOptions will not take effect so we must always
|
// If we're frontmost and we have a notch then we keep padding
|
||||||
// do the visible menu mode since we can't get rid of the menu.
|
// so all lines of the terminal are visible.
|
||||||
let mode: FullscreenMode = if (NSApp.isFrontmost) {
|
if (window?.screen?.hasNotch ?? false) {
|
||||||
.nonNative
|
mode = .nonNativePaddedNotch
|
||||||
|
} else {
|
||||||
|
mode = .nonNative
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
.nonNativeVisibleMenu
|
// An additional detail is that if the is NOT frontmost, then our
|
||||||
|
// NSApp.presentationOptions will not take effect so we must always
|
||||||
|
// do the visible menu mode since we can't get rid of the menu.
|
||||||
|
mode = .nonNativeVisibleMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleFullscreen(mode: mode)
|
toggleFullscreen(mode: mode)
|
||||||
|
@ -34,4 +34,11 @@ extension NSScreen {
|
|||||||
|
|
||||||
return visibleFrame.height < (frame.height - max(menuHeight, notchInset) - boundaryAreaPadding)
|
return visibleFrame.height < (frame.height - max(menuHeight, notchInset) - boundaryAreaPadding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the screen has a visible notch (i.e., a non-zero safe area inset at the top).
|
||||||
|
var hasNotch: Bool {
|
||||||
|
// We assume that a top safe area means notch, since we don't currently
|
||||||
|
// know any other situation this is true.
|
||||||
|
return safeAreaInsets.top > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user