summaryrefslogtreecommitdiff
path: root/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-04-14 10:37:54 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-04-14 10:38:54 -0700
commit453e6590e8a648b7bf6617afb71e7fc07ad782a7 (patch)
tree0b7ceb8ba17c458b003fce27e31dd9e294a978b3 /macos/Sources/Features/QuickTerminal/QuickTerminalController.swift
parent9d9d781a0b7142ddc176167ef5e889618d295ef5 (diff)
macOS: non-native fullscreen should not hide menu on fullscreen space
Fixes #7075 We have to use private APIs for this, I couldn't find a reliable way otherwise.
Diffstat (limited to 'macos/Sources/Features/QuickTerminal/QuickTerminalController.swift')
-rw-r--r--macos/Sources/Features/QuickTerminal/QuickTerminalController.swift12
1 files changed, 3 insertions, 9 deletions
diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift
index fac3a2fbb..896b25326 100644
--- a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift
+++ b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift
@@ -3,12 +3,6 @@ import Cocoa
import SwiftUI
import GhosttyKit
-// This is a Apple's private function that we need to call to get the active space.
-@_silgen_name("CGSGetActiveSpace")
-func CGSGetActiveSpace(_ cid: Int) -> size_t
-@_silgen_name("CGSMainConnectionID")
-func CGSMainConnectionID() -> Int
-
/// Controller for the "quick" terminal.
class QuickTerminalController: BaseTerminalController {
override var windowNibName: NSNib.Name? { "QuickTerminal" }
@@ -25,7 +19,7 @@ class QuickTerminalController: BaseTerminalController {
private var previousApp: NSRunningApplication? = nil
// The active space when the quick terminal was last shown.
- private var previousActiveSpace: size_t = 0
+ private var previousActiveSpace: CGSSpace? = nil
/// Non-nil if we have hidden dock state.
private var hiddenDock: HiddenDock? = nil
@@ -154,7 +148,7 @@ class QuickTerminalController: BaseTerminalController {
animateOut()
case .move:
- let currentActiveSpace = CGSGetActiveSpace(CGSMainConnectionID())
+ let currentActiveSpace = CGSSpace.active()
if previousActiveSpace == currentActiveSpace {
// We haven't moved spaces. We lost focus to another app on the
// current space. Animate out.
@@ -224,7 +218,7 @@ class QuickTerminalController: BaseTerminalController {
}
// Set previous active space
- self.previousActiveSpace = CGSGetActiveSpace(CGSMainConnectionID())
+ self.previousActiveSpace = CGSSpace.active()
// Animate the window in
animateWindowIn(window: window, from: position)