mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Reorganize a bit
This commit is contained in:
@ -185,6 +185,23 @@ class TerminalWindow: NSWindow {
|
||||
|
||||
// MARK: -
|
||||
|
||||
private var newTabButtonImageLayer: VibrantLayer? = nil
|
||||
|
||||
// Since we are coloring the new tab button's image, it doesn't respond to the
|
||||
// window's key status changes in terms of becoming less prominent visually,
|
||||
// so we need to do it manually.
|
||||
private func updateNewTabButtonOpacity() {
|
||||
guard let titlebarContainer = contentView?.superview?.subviews.first(where: {
|
||||
$0.className == "NSTitlebarContainerView"
|
||||
}) else { return }
|
||||
guard let newTabButton: NSButton = titlebarContainer.firstDescendant(withClassName: "NSTabBarNewTabButton") as? NSButton else { return }
|
||||
guard let newTabButtonImageView: NSImageView = newTabButton.subviews.first(where: {
|
||||
$0 as? NSImageView != nil
|
||||
}) as? NSImageView else { return }
|
||||
|
||||
newTabButtonImageView.alphaValue = isKeyWindow ? 1 : 0.5
|
||||
}
|
||||
|
||||
private func updateUnZoomToolbarButtonVisibility() {
|
||||
guard let unZoomToolbarButton = unZoomToolbarButton, let tabGroup else { return }
|
||||
|
||||
@ -220,7 +237,6 @@ class TerminalWindow: NSWindow {
|
||||
|
||||
private var windowButtonsBackdrop: WindowButtonsBackdropView? = nil
|
||||
private var windowDragHandle: WindowDragView? = nil
|
||||
private var newTabButtonImageLayer: VibrantLayer? = nil
|
||||
|
||||
// The tab bar controller ID from macOS
|
||||
static private let TabBarController = NSUserInterfaceItemIdentifier("_tabBarController")
|
||||
@ -326,21 +342,6 @@ class TerminalWindow: NSWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Since we are coloring the new tab button's image, it doesn't respond to the
|
||||
// window's key status changes in terms of becoming less prominent visually,
|
||||
// so we need to do it manually.
|
||||
private func updateNewTabButtonOpacity() {
|
||||
guard let titlebarContainer = contentView?.superview?.subviews.first(where: {
|
||||
$0.className == "NSTitlebarContainerView"
|
||||
}) else { return }
|
||||
guard let newTabButton: NSButton = titlebarContainer.firstDescendant(withClassName: "NSTabBarNewTabButton") as? NSButton else { return }
|
||||
guard let newTabButtonImageView: NSImageView = newTabButton.subviews.first(where: {
|
||||
$0 as? NSImageView != nil
|
||||
}) as? NSImageView else { return }
|
||||
|
||||
newTabButtonImageView.alphaValue = isKeyWindow ? 1 : 0.5
|
||||
}
|
||||
|
||||
private func addWindowButtonsBackdrop(titlebarView: NSView, toolbarView: NSView) {
|
||||
// If we already made the view, just make sure it's unhidden and correctly placed as a subview.
|
||||
if let view = windowButtonsBackdrop {
|
||||
|
Reference in New Issue
Block a user