mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Fix quick terminal fullscreen toggle in front of fullscreen window
Implements custom fullscreen toggle for quick terminal to avoid presentation options conflicts when toggling fullscreen in front of an already fullscreen window.
This commit is contained in:
@ -33,6 +33,9 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
/// The configuration derived from the Ghostty config so we don't need to rely on references.
|
/// The configuration derived from the Ghostty config so we don't need to rely on references.
|
||||||
private var derivedConfig: DerivedConfig
|
private var derivedConfig: DerivedConfig
|
||||||
|
|
||||||
|
/// Storage for the window frame before entering fullscreen mode
|
||||||
|
private var savedWindowFrame: NSRect? = nil
|
||||||
|
|
||||||
init(_ ghostty: Ghostty.App,
|
init(_ ghostty: Ghostty.App,
|
||||||
position: QuickTerminalPosition = .top,
|
position: QuickTerminalPosition = .top,
|
||||||
baseConfig base: Ghostty.SurfaceConfiguration? = nil,
|
baseConfig base: Ghostty.SurfaceConfiguration? = nil,
|
||||||
@ -485,9 +488,16 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
@objc private func onToggleFullscreen(notification: SwiftUI.Notification) {
|
@objc private func onToggleFullscreen(notification: SwiftUI.Notification) {
|
||||||
guard let target = notification.object as? Ghostty.SurfaceView else { return }
|
guard let target = notification.object as? Ghostty.SurfaceView else { return }
|
||||||
guard target == self.focusedSurface else { return }
|
guard target == self.focusedSurface else { return }
|
||||||
|
guard let window = self.window else { return }
|
||||||
|
guard let screen = window.screen ?? NSScreen.main else { return }
|
||||||
|
|
||||||
// We ignore the requested mode and always use non-native for the quick terminal
|
if let originalFrame = savedWindowFrame {
|
||||||
toggleFullscreen(mode: .nonNative)
|
window.setFrame(originalFrame, display: true)
|
||||||
|
savedWindowFrame = nil
|
||||||
|
} else {
|
||||||
|
savedWindowFrame = window.frame
|
||||||
|
window.setFrame(screen.frame, display: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func ghosttyConfigDidChange(_ notification: Notification) {
|
@objc private func ghosttyConfigDidChange(_ notification: Notification) {
|
||||||
|
Reference in New Issue
Block a user