style: match Raycast notes window
This commit is contained in:
@@ -6,7 +6,6 @@ import ApplicationServices
|
||||
@MainActor
|
||||
final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSearchFieldDelegate, NSTableViewDataSource, NSTableViewDelegate {
|
||||
private let searchField = NSSearchField()
|
||||
private let commandTitle = NSTextField(labelWithString: "Conjure Notes")
|
||||
private let searchSymbol = IconView(font: .systemFont(ofSize: 20))
|
||||
private let commandBack = NSButton(title: "", target: nil, action: nil)
|
||||
private let translationHeader = NSStackView()
|
||||
@@ -265,9 +264,6 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
attributes: [.foregroundColor: SunsetPalette.secondaryText, .font: searchFont]
|
||||
)
|
||||
searchField.textColor = SunsetPalette.text
|
||||
commandTitle.font = searchFont
|
||||
commandTitle.textColor = SunsetPalette.text
|
||||
commandTitle.isHidden = true
|
||||
searchField.isBordered = false
|
||||
searchField.drawsBackground = false
|
||||
searchField.focusRingType = .none
|
||||
@@ -294,7 +290,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
commandBack.heightAnchor.constraint(equalToConstant: IconStyle.applicationSize(for: searchFont)),
|
||||
])
|
||||
translationHeader.isHidden = true
|
||||
let header = NSStackView(views: [searchSymbol, commandBack, searchField, commandTitle, translationHeader])
|
||||
let header = NSStackView(views: [searchSymbol, commandBack, searchField, translationHeader])
|
||||
header.orientation = .horizontal
|
||||
header.alignment = .centerY
|
||||
header.spacing = 12
|
||||
@@ -897,6 +893,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
activeCommand = command
|
||||
history.recordLaunch(of: Application(command: command))
|
||||
let previousQuery = searchField.stringValue
|
||||
let previousFrame = window?.frame
|
||||
let previousPlaceholder = searchField.placeholderAttributedString
|
||||
let close: () -> Void = { [weak self, weak controller] in
|
||||
guard let self, let controller else { return }
|
||||
@@ -907,7 +904,12 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
self.emojiPicker = nil
|
||||
self.notes = nil
|
||||
self.searchField.isHidden = false
|
||||
self.commandTitle.isHidden = true
|
||||
self.launcherViews.first?.isHidden = false
|
||||
self.launcherViews.first?.setAccessibilityHidden(false)
|
||||
if command == .notes, let previousFrame {
|
||||
self.window?.setFrame(previousFrame, display: true)
|
||||
if let material = content as? NSVisualEffectView { roundMaterialCorners(material, radius: 24) }
|
||||
}
|
||||
self.activeCommand = nil
|
||||
self.commandBack.isHidden = true
|
||||
self.commandBack.target = nil
|
||||
@@ -943,8 +945,15 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
)
|
||||
searchField.setAccessibilityLabel(accessibilityLabel)
|
||||
if command == .notes {
|
||||
searchField.isHidden = true
|
||||
commandTitle.isHidden = false
|
||||
launcherViews.first?.isHidden = true
|
||||
launcherViews.first?.setAccessibilityHidden(true)
|
||||
if var frame = window?.frame {
|
||||
frame.origin.x += (frame.width - 570) / 2
|
||||
frame.origin.y = frame.maxY - 404
|
||||
frame.size = NSSize(width: 570, height: 404)
|
||||
window?.setFrame(frame, display: true)
|
||||
}
|
||||
if let material = content as? NSVisualEffectView { roundMaterialCorners(material, radius: 14) }
|
||||
}
|
||||
for view in launcherViews.dropFirst() {
|
||||
view.isHidden = true
|
||||
@@ -959,7 +968,9 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
NSLayoutConstraint.activate([
|
||||
controller.view.leadingAnchor.constraint(equalTo: content.leadingAnchor),
|
||||
controller.view.trailingAnchor.constraint(equalTo: content.trailingAnchor),
|
||||
controller.view.topAnchor.constraint(equalTo: command == .notes ? commandTitle.bottomAnchor : searchField.bottomAnchor, constant: 16),
|
||||
command == .notes
|
||||
? controller.view.topAnchor.constraint(equalTo: content.topAnchor)
|
||||
: controller.view.topAnchor.constraint(equalTo: searchField.bottomAnchor, constant: 16),
|
||||
controller.view.bottomAnchor.constraint(equalTo: content.bottomAnchor),
|
||||
])
|
||||
if let notes { notes.focusEditor() }
|
||||
|
||||
Reference in New Issue
Block a user