|
|
@@ -248,7 +248,6 @@ final class ViewController: NSViewController {
|
|
|
private var zoomJoinModeByView = [ObjectIdentifier: ZoomJoinMode]()
|
|
|
private var zoomJoinModeViews: [ZoomJoinMode: NSView] = [:]
|
|
|
private var settingsActionByView = [ObjectIdentifier: SettingsAction]()
|
|
|
- private weak var centeredTitleLabel: NSTextField?
|
|
|
private var paywallWindow: NSWindow?
|
|
|
private let paywallContentWidth: CGFloat = 520
|
|
|
private let launchWindowLeftOffset: CGFloat = 80
|
|
|
@@ -430,6 +429,7 @@ final class ViewController: NSViewController {
|
|
|
presentLaunchPaywallIfNeeded()
|
|
|
applyWindowTitle(for: selectedSidebarPage)
|
|
|
guard let window = view.window else { return }
|
|
|
+ configureMainWindowChrome(window)
|
|
|
|
|
|
// Ensure launch size is applied even when macOS tries to restore prior window state.
|
|
|
window.isRestorable = false
|
|
|
@@ -452,7 +452,6 @@ final class ViewController: NSViewController {
|
|
|
}
|
|
|
|
|
|
window.minSize = window.frameRect(forContentRect: NSRect(origin: .zero, size: self.launchMinContentSize)).size
|
|
|
- self.installCenteredTitleIfNeeded(on: window)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1866,32 +1865,13 @@ private extension ViewController {
|
|
|
title = "Settings"
|
|
|
}
|
|
|
view.window?.title = title
|
|
|
- centeredTitleLabel?.stringValue = title
|
|
|
}
|
|
|
|
|
|
- private func installCenteredTitleIfNeeded(on window: NSWindow) {
|
|
|
- guard centeredTitleLabel == nil else { return }
|
|
|
- guard let titlebarView = window.standardWindowButton(.closeButton)?.superview else { return }
|
|
|
-
|
|
|
- let label = NSTextField(labelWithString: window.title)
|
|
|
- label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- label.alignment = .center
|
|
|
- label.font = NSFont.titleBarFont(ofSize: 0)
|
|
|
- label.textColor = .labelColor
|
|
|
- label.lineBreakMode = .byTruncatingTail
|
|
|
- label.maximumNumberOfLines = 1
|
|
|
-
|
|
|
- titlebarView.addSubview(label)
|
|
|
-
|
|
|
- NSLayoutConstraint.activate([
|
|
|
- label.centerXAnchor.constraint(equalTo: titlebarView.centerXAnchor),
|
|
|
- label.centerYAnchor.constraint(equalTo: titlebarView.centerYAnchor),
|
|
|
- label.leadingAnchor.constraint(greaterThanOrEqualTo: titlebarView.leadingAnchor, constant: 90),
|
|
|
- label.trailingAnchor.constraint(lessThanOrEqualTo: titlebarView.trailingAnchor, constant: -90)
|
|
|
- ])
|
|
|
-
|
|
|
+ private func configureMainWindowChrome(_ window: NSWindow) {
|
|
|
+ window.styleMask.insert(.fullSizeContentView)
|
|
|
window.titleVisibility = .hidden
|
|
|
- centeredTitleLabel = label
|
|
|
+ window.titlebarAppearsTransparent = true
|
|
|
+ window.isMovableByWindowBackground = true
|
|
|
}
|
|
|
|
|
|
private func updateSidebarAppearance() {
|
|
|
@@ -1919,6 +1899,7 @@ private extension ViewController {
|
|
|
sidebar.layer?.shadowOffset = CGSize(width: 2, height: 0)
|
|
|
sidebar.layer?.shadowRadius = 10
|
|
|
sidebar.widthAnchor.constraint(equalToConstant: 210).isActive = true
|
|
|
+ let sidebarTopInset: CGFloat = 44
|
|
|
|
|
|
let appIconView = NSImageView()
|
|
|
if let headerLogo = NSImage(named: "HeaderLogo") {
|
|
|
@@ -1974,7 +1955,7 @@ private extension ViewController {
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
|
|
titleRow.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 16),
|
|
|
- titleRow.topAnchor.constraint(equalTo: sidebar.topAnchor, constant: 24),
|
|
|
+ titleRow.topAnchor.constraint(equalTo: sidebar.topAnchor, constant: sidebarTopInset),
|
|
|
titleRow.trailingAnchor.constraint(lessThanOrEqualTo: sidebar.trailingAnchor, constant: -16),
|
|
|
|
|
|
menuStack.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 12),
|