mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
hide tab bar if last window is destroyed
This commit is contained in:
@ -507,6 +507,22 @@ pub fn destroy(self: *Window) void {
|
||||
self.io.deinit();
|
||||
}
|
||||
|
||||
if (comptime builtin.target.isDarwin()) {
|
||||
// If our tab bar is visible and we are going down to 1 window,
|
||||
// hide the tab bar.
|
||||
const nswindow = objc.Object.fromId(glfwNative.getCocoaWindow(self.window).?);
|
||||
const tabgroup = nswindow.getProperty(objc.Object, "tabGroup");
|
||||
if (tabgroup.getProperty(bool, "tabBarVisible")) {
|
||||
const windows = tabgroup.getProperty(objc.Object, "windows");
|
||||
|
||||
// count check is 2 because our window will still be present
|
||||
// in the tab bar since we haven't destroyed yet
|
||||
if (windows.getProperty(usize, "count") == 2) {
|
||||
nswindow.msgSend(void, objc.sel("toggleTabBar:"), .{nswindow.value});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.window.destroy();
|
||||
|
||||
// We can destroy the cursor right away. glfw will just revert any
|
||||
|
Reference in New Issue
Block a user