mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Merge pull request #1023 from mitchellh/macos-fs
macos: manually show window to handle mission control behavior
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="👻 Ghostty" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="TerminalWindow" customModule="Ghostty" customModuleProvider="target">
|
||||
<window title="👻 Ghostty" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="TerminalWindow" customModule="Ghostty" customModuleProvider="target">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="0.0" y="0.0" width="800" height="600"/>
|
||||
|
@ -63,16 +63,30 @@ class TerminalManager {
|
||||
/// Create a new terminal window.
|
||||
func newWindow(withBaseConfig base: Ghostty.SurfaceConfiguration? = nil) {
|
||||
let c = createWindow(withBaseConfig: base)
|
||||
if let window = c.window {
|
||||
Self.lastCascadePoint = window.cascadeTopLeft(from: Self.lastCascadePoint)
|
||||
let window = c.window!
|
||||
|
||||
// We want to go fullscreen if we're configured for new windows to go fullscreen
|
||||
var toggleFullScreen = ghostty.windowFullscreen
|
||||
|
||||
// If the previous focused window prior to creating this window is fullscreen,
|
||||
// then this window also becomes fullscreen.
|
||||
if let parent = focusedSurface?.window, parent.styleMask.contains(.fullScreen) {
|
||||
toggleFullScreen = true
|
||||
}
|
||||
|
||||
if (ghostty.windowFullscreen) {
|
||||
// NOTE: this doesn't properly handle non-native fullscreen yet
|
||||
c.window?.toggleFullScreen(nil)
|
||||
if (toggleFullScreen && !window.styleMask.contains(.fullScreen)) {
|
||||
window.toggleFullScreen(nil)
|
||||
}
|
||||
|
||||
c.showWindow(self)
|
||||
|
||||
// Only cascade if we aren't fullscreen. This has to be dispatched async
|
||||
// because it takes one event loop tick for showWindow to work.
|
||||
if (!window.styleMask.contains(.fullScreen)) {
|
||||
DispatchQueue.main.async {
|
||||
Self.lastCascadePoint = window.cascadeTopLeft(from: Self.lastCascadePoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new tab in the current main window. If there are no windows, a window
|
||||
|
Reference in New Issue
Block a user