mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
@ -96,6 +96,10 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
|
|||||||
// If window decorations are disabled, remove our title
|
// If window decorations are disabled, remove our title
|
||||||
if (!ghostty.windowDecorations) { window.styleMask.remove(.titled) }
|
if (!ghostty.windowDecorations) { window.styleMask.remove(.titled) }
|
||||||
|
|
||||||
|
// If we aren't in full screen, then we want to disable tabbing (see comment
|
||||||
|
// in the delegate function)
|
||||||
|
if (!window.styleMask.contains(.fullScreen)) { disableTabbing() }
|
||||||
|
|
||||||
// Terminals typically operate in sRGB color space and macOS defaults
|
// Terminals typically operate in sRGB color space and macOS defaults
|
||||||
// to "native" which is typically P3. There is a lot more resources
|
// to "native" which is typically P3. There is a lot more resources
|
||||||
// covered in thie GitHub issue: https://github.com/mitchellh/ghostty/pull/376
|
// covered in thie GitHub issue: https://github.com/mitchellh/ghostty/pull/376
|
||||||
@ -174,6 +178,27 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
|
|||||||
func windowDidBecomeKey(_ notification: Notification) {
|
func windowDidBecomeKey(_ notification: Notification) {
|
||||||
self.relabelTabs()
|
self.relabelTabs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func windowWillExitFullScreen(_ notification: Notification) {
|
||||||
|
// See comment in this function
|
||||||
|
disableTabbing()
|
||||||
|
}
|
||||||
|
|
||||||
|
func windowWillEnterFullScreen(_ notification: Notification) {
|
||||||
|
// We re-enable the automatic tabbing mode when we enter full screen otherwise
|
||||||
|
// every new tab also enters a new screen.
|
||||||
|
guard let window = self.window else { return }
|
||||||
|
window.tabbingMode = .automatic
|
||||||
|
}
|
||||||
|
|
||||||
|
private func disableTabbing() {
|
||||||
|
// For new windows, explicitly disallow tabbing with other windows.
|
||||||
|
// This overrides the value of userTabbingPreference. Rationale:
|
||||||
|
// Ghostty provides separate "New Tab" and "New Window" actions so
|
||||||
|
// there's no reason to make "New Window" open in a tab.
|
||||||
|
guard let window = self.window else { return }
|
||||||
|
window.tabbingMode = .disallowed;
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - First Responder
|
//MARK: - First Responder
|
||||||
|
|
||||||
|
@ -95,12 +95,6 @@ class TerminalManager {
|
|||||||
// Initialize our controller to load the window
|
// Initialize our controller to load the window
|
||||||
let c = TerminalController(ghostty, withBaseConfig: base)
|
let c = TerminalController(ghostty, withBaseConfig: base)
|
||||||
|
|
||||||
// For new windows, explicitly disallow tabbing with other windows.
|
|
||||||
// This overrides the value of userTabbingPreference. Rationale:
|
|
||||||
// Ghostty provides separate "New Tab" and "New Window" actions so
|
|
||||||
// there's no reason to make "New Window" open in a tab.
|
|
||||||
c.window!.tabbingMode = .disallowed;
|
|
||||||
|
|
||||||
// Create a listener for when the window is closed so we can remove it.
|
// Create a listener for when the window is closed so we can remove it.
|
||||||
let pubClose = NotificationCenter.default.publisher(
|
let pubClose = NotificationCenter.default.publisher(
|
||||||
for: NSWindow.willCloseNotification,
|
for: NSWindow.willCloseNotification,
|
||||||
|
@ -510,6 +510,9 @@ extension Ghostty {
|
|||||||
guard let windowController = windowControllerRaw as? TerminalController else { return }
|
guard let windowController = windowControllerRaw as? TerminalController else { return }
|
||||||
guard case .noSplit = windowController.surfaceTree else { return }
|
guard case .noSplit = windowController.surfaceTree else { return }
|
||||||
|
|
||||||
|
// If our window is full screen, we do not set the frame
|
||||||
|
guard !window.styleMask.contains(.fullScreen) else { return }
|
||||||
|
|
||||||
// Setup our frame. We need to first subtract the views frame so that we can
|
// Setup our frame. We need to first subtract the views frame so that we can
|
||||||
// just get the chrome frame so that we only affect the surface view size.
|
// just get the chrome frame so that we only affect the surface view size.
|
||||||
var frame = window.frame
|
var frame = window.frame
|
||||||
|
Reference in New Issue
Block a user