mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Hide tab bar shadows which improves light themes
In a light appearance there was a shadow cast on top of the inactive tabs that looked bad. In a dark appearance the shadow manifests as a solid line that required a faux border to look right. This removes both and improves the aesthetics of the tab bar in light themes.
This commit is contained in:
@ -33,7 +33,19 @@ class TerminalWindow: NSWindow {
|
||||
|
||||
// The tab bar controller ID from macOS
|
||||
static private let TabBarController = NSUserInterfaceItemIdentifier("_tabBarController")
|
||||
|
||||
|
||||
override func updateConstraintsIfNeeded() {
|
||||
super.updateConstraintsIfNeeded()
|
||||
|
||||
guard let titlebarContainer = contentView?.superview?.firstSubview(withClassName: "NSTitlebarContainerView") else {
|
||||
return
|
||||
}
|
||||
|
||||
for v in titlebarContainer.subviews(withClassName: "NSTitlebarSeparatorView") {
|
||||
v.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
/// This is called by titlebarTabs changing so that we can setup the rest of our window
|
||||
private func changedTitlebarTabs(to newValue: Bool) {
|
||||
self.titlebarAppearsTransparent = newValue
|
||||
@ -191,24 +203,13 @@ class TerminalWindow: NSWindow {
|
||||
view.heightAnchor.constraint(equalTo: toolbarView.heightAnchor).isActive = true
|
||||
view.wantsLayer = true
|
||||
|
||||
let topBorder = NSView()
|
||||
view.addSubview(topBorder)
|
||||
topBorder.translatesAutoresizingMaskIntoConstraints = false
|
||||
topBorder.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
topBorder.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
|
||||
topBorder.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
topBorder.bottomAnchor.constraint(equalTo: view.topAnchor, constant: 1).isActive = true
|
||||
topBorder.wantsLayer = true
|
||||
|
||||
// This is jank but this makes the background color for light themes on the button
|
||||
// backdrop look MUCH better. I couldn't figure out a perfect color to use that works
|
||||
// for both so we just check the appearance.
|
||||
if effectiveAppearance.name == .aqua {
|
||||
view.layer?.backgroundColor = CGColor(genericGrayGamma2_2Gray: 0.95, alpha: 1)
|
||||
topBorder.layer?.backgroundColor = CGColor(genericGrayGamma2_2Gray: 0.0, alpha: 0.2)
|
||||
} else {
|
||||
view.layer?.backgroundColor = CGColor(genericGrayGamma2_2Gray: 0.0, alpha: 0.45)
|
||||
topBorder.layer?.backgroundColor = CGColor(genericGrayGamma2_2Gray: 0.0, alpha: 0.85)
|
||||
}
|
||||
|
||||
windowButtonsBackdrop = view
|
||||
|
Reference in New Issue
Block a user