From 3c8d9ae5a3bb10a05bba96ec2c10938297604980 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Ahdal Date: Thu, 24 Oct 2024 03:00:17 -0600 Subject: [PATCH 1/3] Fix: aerospace no longer resizes quick terminal and instead treats it as float --- .../Sources/Features/QuickTerminal/QuickTerminalWindow.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift index 2d9d1df7c..37f80260c 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift @@ -12,6 +12,11 @@ class QuickTerminalWindow: NSWindow { // Note: almost all of this stuff can be done in the nib/xib directly // but I prefer to do it programmatically because the properties we // care about are less hidden. + + // Set the base style mask to be HUD Window (which satisfies the AeroSpace + // window manager's heuristics allowing the quick terminal window to be + // unaffected by AeroSpace's window positioning and resizing) + self.styleMask = .hudWindow // Remove the title completely. This will make the window square. One // downside is it also hides the cursor indications of resize but the From 5a1d09bcc6ec02a97b446ab5d6774c53e6e50cda Mon Sep 17 00:00:00 2001 From: Mohammad Al-Ahdal Date: Fri, 25 Oct 2024 03:57:39 -0600 Subject: [PATCH 2/3] Suggestion to use window identifier instead of trying to appease heuristics --- .../Features/QuickTerminal/QuickTerminalWindow.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift index 37f80260c..46707e255 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift @@ -13,10 +13,9 @@ class QuickTerminalWindow: NSWindow { // but I prefer to do it programmatically because the properties we // care about are less hidden. - // Set the base style mask to be HUD Window (which satisfies the AeroSpace - // window manager's heuristics allowing the quick terminal window to be - // unaffected by AeroSpace's window positioning and resizing) - self.styleMask = .hudWindow + // Add a custom identifier so third party apps can use the Accessibility + // API to apply special rules to the quick terminal. + self.identifier = .init(rawValue: "com.mitchellh.ghostty.quickTerminal") // Remove the title completely. This will make the window square. One // downside is it also hides the cursor indications of resize but the From 88119d0c17827ae28d9ab1d5bfb7cf0ccd119d4a Mon Sep 17 00:00:00 2001 From: Mohammad Al-Ahdal Date: Fri, 25 Oct 2024 05:37:31 -0600 Subject: [PATCH 3/3] default AXSubrole to .floatingWindow --- .../Sources/Features/QuickTerminal/QuickTerminalWindow.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift index 46707e255..ed3a7f781 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalWindow.swift @@ -16,6 +16,10 @@ class QuickTerminalWindow: NSWindow { // Add a custom identifier so third party apps can use the Accessibility // API to apply special rules to the quick terminal. self.identifier = .init(rawValue: "com.mitchellh.ghostty.quickTerminal") + + // Set the correct AXSubrole of kAXFloatingWindowSubrole (allows + // AeroSpace to treat the Quick Terminal as a floating window) + self.setAccessibilitySubrole(.floatingWindow) // Remove the title completely. This will make the window square. One // downside is it also hides the cursor indications of resize but the