Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] feat: Support Tabs in Quick Terminal #5370

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

sohsatoh
Copy link
Contributor

@sohsatoh sohsatoh commented Jan 25, 2025

related to #2329

This pull request implements a tab management feature for the Quick Terminal in the Ghostty for macOS.

macOS does not support tab management without a title bar. Therefore, this PR implements non-native tabs instead of using macOS native tabs.

Changes

  • Add tab management feature for Quick Terminal

Appearance

window-theme = dark

スクリーンショット 2025-01-26 19 21 54

window-theme = light

スクリーンショット 2025-01-26 19 22 18

Notes

The implementation is designed to work similarly to native tabs and to behave consistently with the (standard) terminal windows in Ghostty. However, there may be some aspects I might have overlooked. Please feel free to make any necessary fixes to the implementation as needed.

animateOut()
}

@IBAction func newTab(_ sender: Any?) {
Copy link
Contributor Author

@sohsatoh sohsatoh Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝
This is never called because the window is an NSPanel without a title bar. So, I removed it and added the observer for Ghostty.Notification.ghosttyNewTab.

@@ -329,6 +329,9 @@ class TerminalManager {
guard let surfaceView = notification.object as? Ghostty.SurfaceView else { return }
guard let window = surfaceView.window else { return }

// return if window is not in our managed windows
guard windows.contains(where: { $0.controller.window == window }) else { return }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝
If the window is not managed by the TerminalManager (which is usually the case when it is managed by the QuickTerminalManager), the process will be aborted. Without this, a new TerminalWindow would be created.

@sohsatoh sohsatoh force-pushed the feat/quickterm-with-tab branch from be37844 to 98a0e07 Compare January 26, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant